home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 September / PCWorld_2008-09_cd.bin / v cisle / sadanastroju / interclue-1.5.6-fx.xpi / chrome / interclue / content / cluecore / interclue.js < prev    next >
Text File  |  2008-06-17  |  502KB  |  9,732 lines

  1. if(Klib.install("App",0.1)){Klib.App.name="Interclue";
  2. Klib.App.subName="";
  3. Klib.App.version="1.5.6";
  4. Klib.App.build=5518;
  5. Klib.App.guid="{c33c5b47-69c8-45a4-a5e0-af85bbe628dd}";
  6. Klib.App.requireLogin=false;
  7. Klib.App.buildId="987bcab01b929eb2c07877b224215c92";
  8. Klib.App.buildType="stable";
  9. Klib.App.beta={};
  10. Klib.App.beta.build=0;
  11. Klib.App.beta.downloadUrl=""
  12. }if(Klib.install("Global",0.1)){Klib.Globals={};
  13. Klib.Global.get=function(A,B){Klib.error("Klib.Global.get not written for "+Klib.platform+":"+A+":"+B)
  14. };
  15. Klib.Global.set=function(A,B){Klib.error("Klib.Global.set not written for "+Klib.platform+":"+A+":"+B)
  16. };
  17. Klib.Global.load=function(){Klib.error("Klib.Global.load not written for "+Klib.platform)
  18. };
  19. Klib.Global.inc=function(A){var B=Klib.Global.get(A,0);
  20. Klib.Global.set(A,(B+1))
  21. }
  22. }if(Klib.install("GEvent",0.1)){Klib.GEvent.timer=0;
  23. Klib.GEvent.stopped=true;
  24. Klib.GEvent.eventHandlers={};
  25. Klib.GEvent.MAX_EVENTS_AGE=10000;
  26. Klib.GEvent.TICK_INTERVAL=1000;
  27. Klib.GEvent.getEventQueue=function(){var A=Klib.Global.get("globalEventQueue",[]);
  28. return(A.length)?A:[]
  29. };
  30. Klib.GEvent.addEventToQueue=function(B){var A=Klib.GEvent.getEventQueue();
  31. A.push(B);
  32. Klib.Global.set("globalEventQueue",A)
  33. };
  34. Klib.GEvent.fire=function(D,C){Klib.GEvent.fireLocal(D,C);
  35. var B=Klib.GEvent.getTick();
  36. var A={};
  37. A.time=B;
  38. A.type=D;
  39. A.data=C;
  40. A.origWin=window;
  41. Klib.GEvent.addEventToQueue(A)
  42. };
  43. Klib.GEvent.fireLocal=function(B,A){Klib.GEvent.handleEvent(B,A)
  44. };
  45. Klib.GEvent.getTick=function(){var A=new Date();
  46. return A.getTime()
  47. };
  48. Klib.GEvent.removeOldEvents=function(D,C){var E=C-Klib.GEvent.MAX_EVENTS_AGE;
  49. var A=[];
  50. for(var B=0;
  51. B<D.length;
  52. B++){if(D[B].time>E){A.push(D[B])
  53. }}Klib.Global.set("globalEventQueue",A)
  54. };
  55. Klib.GEvent.heartbeat=function(){var C=Klib.GEvent.getTick();
  56. var B=Klib.GEvent.getEventQueue();
  57. if(Klib.GEvent.lastCleanup<(C-3000)){Klib.GEvent.removeOldEvents(B,C);
  58. Klib.GEvent.lastCleanup=C
  59. }for(var A=0;
  60. A<B.length;
  61. A++){if((B[A].time>Klib.GEvent.lastTick)&&(B[A].time<=C)){if(B[A].origWin!==window){Klib.GEvent.handleEvent(B[A].type,B[A].data)
  62. }else{}}}Klib.GEvent.lastTick=C;
  63. if(!Klib.GEvent.stopped&&!Klib.documentIsUnloading&&window&&window.setTimeout){Klib.GEvent.timer=window.setTimeout(Klib.GEvent.heartbeat,Klib.GEvent.TICK_INTERVAL)
  64. }};
  65. Klib.GEvent.addEvent=function(B,A){Klib.GEvent.eventHandlers[B]=Klib.GEvent.eventHandlers[B]||[];
  66. Klib.GEvent.eventHandlers[B].push(A)
  67. };
  68. Klib.GEvent.removeEvent=function(E,D){var A=Klib.GEvent.eventHandlers[E];
  69. var C=[];
  70. for(var B=0;
  71. B<A.length;
  72. B++){if(A[B]!=D){C.push(A[B])
  73. }}Klib.GEvent.eventHandlers[E]=C
  74. };
  75. Klib.GEvent.handleEvent=function(E,C){if(Klib.GEvent.eventHandlers[E]){for(var A=0;
  76. A<Klib.GEvent.eventHandlers[E].length;
  77. A++){var B=Klib.GEvent.eventHandlers[E][A];
  78. try{B(C)
  79. }catch(D){Klib.error("Klib.GEvent.handleEvent failed",E,C,B,D)
  80. }}}};
  81. Klib.GEvent.stop=function(){Klib.GEvent.stopped=true
  82. };
  83. Klib.GEvent.cleanUp=function(){Klib.GEvent.stop()
  84. };
  85. Klib.GEvent.start=function(){Klib.GEvent.stopped=false;
  86. Klib.GEvent.lastTick=Klib.GEvent.getTick()-1;
  87. Klib.GEvent.lastCleanup=Klib.GEvent.lastTick;
  88. Klib.GEvent.heartbeat()
  89. }
  90. }if(Klib.install("Cookie",0.1)){Klib.Cookie.MAX_COOKIE_LENGTH=4000;
  91. Klib.Cookie.set=function(D,E,A){var B="";
  92. if(A){var C=new Date();
  93. C.setTime(C.getTime()+(A*24*60*60*1000));
  94. B="; expires="+C.toGMTString()
  95. }document.cookie=(D+"="+escape(E)+B+"; path=/")
  96. };
  97. Klib.Cookie.get=function(A,E){var D=new RegExp("\\b"+A+"=([^;]*)","i");
  98. var B=document.cookie.match(D);
  99. if(B){var C=unescape(B[1]);
  100. if(C.toLowerCase()=="true"){return true
  101. }if(C.toLowerCase()=="false"){return false
  102. }return C
  103. }else{return E
  104. }};
  105. Klib.Cookie.kill=function(A){if(A.indexOf("*")>-1){var C=new RegExp("(\\b"+Klib.escapeRegExStr(A,["*=[^=]*"])+")","gi");
  106. var D=document.cookie.match(C);
  107. if(D){for(var B=0;
  108. B<D.length;
  109. B++){Klib.Cookie.kill(D[B])
  110. }}}Klib.Cookie.set(A,"",-1)
  111. };
  112. Klib.Cookie.dump=function(){var B=document.cookie.split(/;/g);
  113. for(var A=0;
  114. A<B.length;
  115. A++){B[A]=unescape(B[A])
  116. }alert(B.join("\n"))
  117. }
  118. }Klib.Cluebar=Klib.Cluebar||{};
  119. Klib.Cluebar.buttons={};
  120. Klib.Cluebar.getBar=function(B){var A=B.getElementById("interclue-toolbar");
  121. if(!A){A=Klib.DOM.create("div",{id:"interclue-toolbar"},B);
  122. Klib.setCSS(A,Klib.getStyles("interclue-cluebar"));
  123. Klib.Cluebar.buildButtons(A);
  124. B.body.appendChild(A)
  125. }return A
  126. };
  127. Klib.Cluebar.show=function(D,B,A){var C=Klib.Cluebar.getBar(D);
  128. Klib.setStyle(C,"top",A+"px");
  129. Klib.setStyle(C,"left",B+"px");
  130. Klib.setStyle(C,"display","block")
  131. };
  132. Klib.Cluebar.hide=function(A){Klib.setStyle(Klib.Cluebar.getBar(A),"display","none")
  133. };
  134. Klib.Cluebar.initDoc=function(A){};
  135. Klib.Cluebar.cleanupDoc=function(B){Klib.removeEvent(B,"mouseup",Klib.Cluebar.handleMouseUp);
  136. var A=B.getElementById("interclue-toolbar");
  137. if(A){Klib.removeEle(A)
  138. }};
  139. Klib.Cluebar.isVisible=function(B){var A=B.getElementById("interclue-toolbar");
  140. return(A&&A.style.display=="block")
  141. };
  142. Klib.Cluebar.handleMouseUp=function(A){if(A.button==0){if(A.target&&Klib.findParent(A.target,function(B){return B.id=="interclue-toolbar"
  143. },true)){return 
  144. }setTimeout(function(){var D=A.doc;
  145. var B=Klib.getSelectedHtml(D);
  146. var C=Klib.Cluebar.getBar(D);
  147. if(B&&Klib.Cluebar.isVisible(D)&&C.lastSelectedHtml==B){return 
  148. }else{if(B){C.lastSelectedHtml=B;
  149. Klib.Cluebar.show(D,A.docX+16,A.docY-(16+22))
  150. }else{Klib.Cluebar.hide(D)
  151. }}},100)
  152. }else{return 
  153. }};
  154. Klib.Cluebar.buildButtons=function(B){for(var C in Klib.Cluebar.buttons){var A=new Klib.Button(Klib.Cluebar.buttons[C]);
  155. A.classname="interclue-cluebar-button";
  156. A.buttonCSS=Klib.styles["interclue-cluebar-button"];
  157. A.imageCSS=Klib.styles["interclue-cluebar-button-img"];
  158. A.appendTo(B);
  159. A.enable()
  160. }};
  161. Klib.Cluebar.buttons.test={onclick:function(A,B){var B={selectedHTML:Klib.getSelectedHtml(A.doc),selectedText:Klib.getSelectedText(A.doc),location:A.doc.URL};
  162. debug(B)
  163. },tooltip:"test-foo",sprite:"interclue"};
  164. Klib.Cluebar.buttons["test-2"]={onclick:function(A,B){var B={selectedHTML:Klib.getSelectedHtml(A.doc),selectedText:Klib.getSelectedText(A.doc),location:A.doc.URL};
  165. debug(B)
  166. },tooltip:"test-baa",sprite:"interclueEnabled"};
  167. Klib.DOM=Klib.DOM||{};
  168. Klib.DOM.create=function(C,A,E){var D=E.createElement(C);
  169. if(A){for(var B in A){D[B]=A[B];
  170. D.setAttribute(B,A[B])
  171. }}return D
  172. };
  173. if(Klib.install("Timer",0.1)){Klib.Profiler=function(A){var B=this;
  174. B.title=A||"";
  175. B.marks=[];
  176. B.displayMsg=function(){alert(B.getMsg())
  177. };
  178. B.getMsg=function(){var D="== "+B.title+" ==\n";
  179. for(var C=0;
  180. C<B.marks.length;
  181. C++){D+=B.marks[C].name+" : "+B.marks[C].elapsed+" ms\n"
  182. }D+="total time : "+B.total_time+" ms\n";
  183. return D
  184. };
  185. B.start=function(){var C=new Date();
  186. B.start_time=C.getTime();
  187. B.marks=[];
  188. B.marks[0]={time:B.start_time,name:"start",elapsed:0}
  189. };
  190. B.mark=function(E){var D=new Date();
  191. var F=D.getTime();
  192. var C=B.marks.length;
  193. B.marks[C]={time:F,name:E,elapsed:(F-B.marks[C-1].time)}
  194. };
  195. B.stop=function(C){var D=new Date();
  196. B.stop_time=D.getTime();
  197. B.total_time=(B.stop_time-B.start_time);
  198. if(C=="sum"){B.showSum()
  199. }else{if(C){B.displayMsg()
  200. }}B.reset()
  201. };
  202. B.reset=function(){B.start()
  203. };
  204. B.showSum=function(){var F={};
  205. for(var D=0;
  206. D<B.marks.length;
  207. D++){var C=B.marks[D].name;
  208. if(!F[C]){F[C]={sum:0,c:0}
  209. }F[C].sum+=B.marks[D].elapsed;
  210. F[C].c++
  211. }var E="== "+B.title+" ==\n";
  212. for(var C in F){E+=C+" = "+F[C].sum+" ms ("+F[C].c+")\n"
  213. }E+="total time : "+B.total_time+" ms\n";
  214. alert(E)
  215. };
  216. B.start()
  217. }
  218. }if(Klib.install("Timeout",0.1)){Klib.Timer.debugging=true;
  219. Klib.Timer.heartbeat=0;
  220. Klib.Timer.kill=false;
  221. Klib.Timer.guid=0;
  222. Klib.Timer.items={};
  223. Klib.Timer.lastDebugMsg="";
  224. Klib.Timer.getTick=function(){var A=new Date();
  225. return A.getTime()
  226. };
  227. Klib.Timer.debug=function(){var E="";
  228. for(var B in Klib.Timer.items){if(parseInt(B)||B==="0"){E+="[function]"+Klib.Timer.items[B].func.toString()+"\n"
  229. }else{E+=B+","+Klib.Timer.items[B].interval+"\n"
  230. }}if(Klib.platform){E+="\n=== global events ===\n";
  231. var A=Klib.GEvent.getEventQueue();
  232. for(var C=0;
  233. C<A.length;
  234. C++){E+=(A[C].type+" : "+A[C].time)+" : ";
  235. try{E+=A[C].data
  236. }catch(D){Klib.warning(D,A[C].data);
  237. E+="[error converting data to string]"
  238. }E+="\n"
  239. }}if(Klib.Timer.lastDebugMsg!=E){Klib.Timer.lastDebugMsg=E;
  240. try{if(Klib.Log.win&&Klib.Log.win.document){$("timerLog",Klib.Log.win.document).value=E
  241. }}catch(D){}}};
  242. Klib.setInterval=function(B,C,A){return Klib.setNamedTimer(B,C,A,"false")
  243. };
  244. Klib.Timer.exists=function(A){return Klib.Timer.items[A]?true:false
  245. };
  246. Klib.Timer.tick=function(){if(window.Klib&&Klib.Timer&&!Klib.documentIsUnloading){var tick=Klib.Timer.getTick();
  247. var queueLength=0;
  248. for(var name in Klib.Timer.items){var item=Klib.Timer.items[name];
  249. queueLength++;
  250. if(item&&(((item.lastfired)+parseInt(item.interval))<parseInt(tick))){var lastfired=item.lastfired;
  251. try{if(typeof item.func=="string"){eval(item.func)
  252. }else{item.func()
  253. }}catch(e){var msg=(item.func&&item.func.toString)?item.func.toString():item.func;
  254. Klib.warning("function call failed",name,e,msg)
  255. }if(!window.Klib){return 
  256. }if(Klib.Timer.items[name]&&eval(item.until)&&(lastfired==Klib.Timer.items[name].lastfired)){delete Klib.Timer.items[name]
  257. }else{item.lastfired=tick
  258. }}}if(Klib.Timer.debugging){Klib.Timer.debug()
  259. }if(!Klib.Timer.kill&&window&&window.setTimeout&&!Klib.documentIsUnloading){Klib.Timer.heartbeat=window.setTimeout(Klib.Timer.tick,1)
  260. }}};
  261. Klib.Timer.init=function(){Klib.Timer.items={};
  262. if(Klib.Timer.heartbeat&&window&&window.clearTimeout&&!Klib.documentIsUnloading){window.clearTimeout(Klib.Timer.heartbeat)
  263. }if(window&&window.setTimeout&&!Klib.documentIsUnloading){Klib.Timer.heartbeat=window.setTimeout(Klib.Timer.tick,1)
  264. }};
  265. Klib.Timer.cleanUp=function(){clearTimeout(Klib.Timer.heartbeat);
  266. Klib.Timer.heartbeat=0
  267. };
  268. Klib.setNamedTimer=function(B,C,A,D){D=D||"true";
  269. Klib.Timer.items[B]={func:C,interval:A,lastfired:Klib.Timer.getTick(),until:D};
  270. return B
  271. };
  272. Klib.setTimer=function(B,A,C){return Klib.setNamedTimer(Klib.Timer.guid++,B,A,C)
  273. };
  274. Klib.clearTimer=function(A){if(Klib.Timer.items[A]){delete Klib.Timer.items[A]
  275. }};
  276. Klib.Timer.init()
  277. }if(Klib.install("BugReporter",0.1)){Klib.BugReporter.initDocLinks=function(E){var A=E.getElementsByTagName("a");
  278. var C=A.length;
  279. for(var B=0;
  280. B<C;
  281. B++){var D=A[B];
  282. if(D&&D.getAttribute("bugreporter")){Klib.addEvent(D,"click",Klib.BugReporter.openWin)
  283. }}};
  284. Klib.getElesByName=function(B,E){var A=[];
  285. E=E||document;
  286. var D=E.getElementsByName(B);
  287. for(var C=0;
  288. C<D.length;
  289. C++){A.push(D[C])
  290. }return A
  291. };
  292. Klib.BugReporter.initLinks=function(E,D){var A=Klib.getEles("a",E);
  293. for(var B=0;
  294. B<A.length;
  295. B++){var C=A[B];
  296. if(C.getAttribute("href")&&C.getAttribute("href").indexOf("{")==0){C.setAttribute("href",Klib.translate(C.getAttribute("href")))
  297. }Klib.addEvent(C,"click",function(F){var G=F.source.getAttribute("href");
  298. if(G&&G!="javascript:;"){Klib.ClueBridge.openUrl(G,true,true);
  299. F.halt();
  300. D.close()
  301. }})
  302. }};
  303. Klib.BugReporter.initWindow=function(E){var D=E.document;
  304. if(!D){return false
  305. }Klib.Window.loading(D,true);
  306. if(Klib.Pref.get("BugReporter.showTranslationPanel")){$("translation-tab-title",D).setAttribute("disabled","");
  307. $("translation-tab-title",D).style.display="block";
  308. $("translation-tab-panel",D).setAttribute("disabled","");
  309. $("translation-tab-panel",D).style.display="block"
  310. }E.Tabbox.initDoc(D);
  311. Klib.Pref.initDoc(D);
  312. $("ticket-build",D).value=Klib.App.build;
  313. $("ticket-platform",D).value=Klib.platform;
  314. Klib.BugReporter.initLinks(D,E);
  315. $("userName",D).value=Klib.Pref.get("User.name","");
  316. $("userEmail",D).value=Klib.Pref.get("User.email","");
  317. $("userWebsite",D).value=Klib.Pref.get("User.website","");
  318. Klib.setAttr(Klib.getElesByName("userName",D),"value",Klib.Pref.get("User.name",""));
  319. Klib.setAttr(Klib.getElesByName("userEmail",D),"value",Klib.Pref.get("User.email",""));
  320. Klib.setAttr(Klib.getElesByName("userWebsite",D),"value",Klib.Pref.get("User.website",""));
  321. var B=Klib.ClueFrame.getCurrentLink();
  322. var A=Klib.ClueBridge.lastDoc;
  323. if(B){Klib.setAttr(Klib.getElesByName("linkText",D),"value",Klib.innerText(B));
  324. Klib.setAttr(Klib.getElesByName("linkDest",D),"value",B.href);
  325. if(B.linkscent&&B.linkscent.current&&B.linkscent.current.length){$("linkLinkScents",D).value=B.linkscent.current.join(",")
  326. }A=B.ownerDocument
  327. }if(A){$("linkscentMode",D).value=Klib.Security.isDocEnabled(A)?"enabled":"disabled";
  328. $("isPrivateUrl",D).value=Klib.Clue.isPrivateUrl(A.URL);
  329. Klib.setAttr(Klib.getElesByName("linkLocation",D),"value",A.URL);
  330. Klib.setAttr(Klib.getElesByName("linkLocation",D),"value",A.URL)
  331. }if(Klib.Clue.currentClue){$("clueCurrent",D).value=Klib.Clue.currentClue.id
  332. }E._=_;
  333. if(Klib.platform!="IEToolbar"){Klib.translate(D)
  334. }$("bugreporter-form",D).action=Klib.urls.bugreporter;
  335. E.bugReporterAjaxForm=new Klib.AjaxForm.Obj($("bugreporter-form",D));
  336. E.bugReporterAjaxForm.onSuccess=Klib.BugReporter.handleSuccess;
  337. E.bugReporterAjaxForm.onBeforeSubmit=Klib.BugReporter.formatReport;
  338. Klib.addEvent($("bugreporter-view-report",D),"click",Klib.BugReporter.viewReport);
  339. try{Klib.BugReporter.onWinReady(E)
  340. }catch(C){}Klib.Window.loading(D,false);
  341. return true
  342. };
  343. Klib.BugReporter.getReport=function(S,E){E=E||Klib.getWin(S).bugReporterAjaxForm;
  344. var M={summary:"",description:"",extra:"",debugLog:"",userPrefs:"",addons:"",themes:"",error:false,errorMsg:"",userEmail:"",userWebsite:""};
  345. var F="";
  346. var O="";
  347. var I="";
  348. var B="";
  349. for(var N=0;
  350. N<E.elements.length;
  351. N++){var H=E.elements[N];
  352. if(H.name=="problem"&&H.checked&&H.id!="problem-none"){I=H.value;
  353. break
  354. }}if(I){if(I=="FeatureRequest"&&!$("FeatureRequest-comments",S).value){M.error=true;
  355. M.errorMsg=Klib.string("bugreporter.error.feature.request.required")
  356. }var C="";
  357. for(var N=0;
  358. N<E.elements.length;
  359. N++){var H=E.elements[N];
  360. if(H.id.substr(0,I.length)==I){var T=E.extractElementValue(H);
  361. if(T&&!H.disabled){if(H.getAttribute("ticketMainDescription")){C+=T;
  362. O=Klib.BugReporter.tracFormat(H.id.replace(/^[^\-]*\-/,""),T)+O
  363. }else{if(H.name&&H.name=="userEmail"){M.userEmail=T
  364. }if(H.name&&H.name=="userWebsite"){M.userWebsite=T
  365. }M[H.id.replace(/^[^\-]*\-/,"")]=T;
  366. O+=Klib.BugReporter.tracFormat(H.id.replace(/^[^\-]*\-/,""),T)
  367. }}}else{if(H.type=="hidden"&&!H.id.match(/^ticket/)){var T=E.extractElementValue(H);
  368. if(T){B+=Klib.BugReporter.tracFormat(H.id,T)
  369. }}else{}}}var A=100;
  370. M.summary=I+": "+Klib.strTruncate(C,A);
  371. M.description=O;
  372. M.extra=B;
  373. if((I=="BadSummary"&&$("BadSummary-includeExtendedDebuggingInfo",E.doc).checked)||(I=="OtherBug"&&$("OtherBug-includeExtendedDebuggingInfo",E.doc).checked)){M.debugLog=Klib.Log.getLog(200);
  374. M.debugLog=M.debugLog.replace(/(file:\/+).*?(\/chrome)/gm,"$1...$2");
  375. M.userPrefs=Klib.Pref.dump(Klib.Pref.privatePrefs);
  376. var P=Components.classes["@mozilla.org/extensions/manager;1"].getService(Components.interfaces.nsIExtensionManager);
  377. var R=2;
  378. var K=4;
  379. var L=15;
  380. var Q=P.getItemList(15,{},{});
  381. var G=[];
  382. var J=[];
  383. for(var N=0;
  384. N<Q.length;
  385. N++){var D=Q[N];
  386. if(D.type==R){G.push(D.name+": "+D.version)
  387. }else{if(D.type==K){J.push(D.name+": "+D.version)
  388. }}}M.addons=G.join("\n");
  389. M.themes=J.join("\n")
  390. }if(M.userEmail||M.emailAboutBug||M.emailWhenFixed){if(!Klib.isEmail(Klib.trim(M.userEmail))){M.error=true;
  391. M.errorMsg=Klib.string("bugreporter.error.invalid.email")
  392. }}}else{M.error=true;
  393. M.errorMsg=Klib.string("bugreporter.error.no.catagory")
  394. }return M
  395. };
  396. Klib.BugReporter.removeTracFormatting=function(A){return A.replace(/(''')|(\[\[BR\]\])|(\{\{\{)|(\}\}\})/g,"")
  397. };
  398. Klib.BugReporter.textboxFormat=function(A){var B="== Report ==\n\n";
  399. B+=A.summary;
  400. B+="\n\n------\n\n";
  401. B+=Klib.BugReporter.removeTracFormatting(A.description);
  402. B+="\n------\n\n";
  403. B+=Klib.BugReporter.removeTracFormatting(A.extra);
  404. B+="\n------\n";
  405. B+=A.debugLog;
  406. B+=A.userPrefs;
  407. B+=A.addons?("\n-- addons --\n"+A.addons):"";
  408. B+=A.themes?("\n-- themes --\n"+A.themes):"";
  409. return B
  410. };
  411. Klib.BugReporter.viewReport=function(B){var C=Klib.getDoc(B.source);
  412. var A=Klib.BugReporter.getReport(C);
  413. if(!A.error){$("bugreporter-report-preview",C).value=Klib.BugReporter.textboxFormat(A);
  414. $("bugreporter-report-viewer",C).style.display="block"
  415. }else{alert(A.errorMsg)
  416. }};
  417. Klib.BugReporter.tracFormat=function(A,B){return"'''"+A+"''' : "+B+" [[BR]]\n"
  418. };
  419. Klib.BugReporter.tracFormatBlock=function(B,A){return"\n=== "+B+" ===\n{{{\n"+A+"\n}}}\n----"
  420. };
  421. Klib.BugReporter.formatReport=function(B){$("bugreporter-report-viewer",B.doc).style.display="none";
  422. var A=Klib.BugReporter.getReport(B.doc,B);
  423. if(!A.error){if(A.userEmail&&(A.userEmail.indexOf("@")>0)){Klib.Pref.set("User.email",A.userEmail)
  424. }if(A.userWebsite){Klib.Pref.set("User.website",A.userWebsite)
  425. }B.overrideFieldsList=["ticket[build]","ticket[platform]","ticket[summary]","ticket[description]","ticket[extra]"];
  426. $("ticket-summary",B.doc).value=A.summary;
  427. $("ticket-description",B.doc).value=A.description;
  428. $("ticket-extra",B.doc).value=A.extra;
  429. if(A.debugLog){$("ticket-extra",B.doc).value+=Klib.BugReporter.tracFormatBlock("debuglog",A.debugLog)
  430. }if(A.userPrefs){$("ticket-extra",B.doc).value+=Klib.BugReporter.tracFormatBlock("userprefs",A.userPrefs)
  431. }if(A.addons){$("ticket-extra",B.doc).value+=Klib.BugReporter.tracFormatBlock("addons",A.addons)
  432. }if(A.themes){$("ticket-extra",B.doc).value+=Klib.BugReporter.tracFormatBlock("themes",A.themes)
  433. }return true
  434. }else{B.showMessage(A.errorMsg,"error");
  435. return false
  436. }};
  437. Klib.BugReporter.handleSuccess=function(A){A.showMessage(Klib.string("bugreporter.report.received"),"success",true);
  438. var B=new Klib.KWindow("InterclueBugReporter");
  439. B.close(2000)
  440. };
  441. Klib.BugReporter.openWin=function(B){if(typeof B=="function"){Klib.BugReporter.onWinReady=B
  442. }else{if(B&&B.source&&B.source.getAttribute("bugreporter")){Klib.BugReporter.onWinReady=function(G){var H="problem-"+B.source.getAttribute("bugreporter");
  443. var F=$(H,G.document);
  444. if(F&&F.click){F.click()
  445. }var E=B.source.getAttribute("bugreportertab")+"-tab";
  446. $("tab-box",G.document).selectTab(E)
  447. }
  448. }else{Klib.BugReporter.onWinReady=function(){}
  449. }}var D=Klib.baseUrl+"/bugreporter/bugreporter.html";
  450. var C=new Klib.KWindow("InterclueBugReporter");
  451. C.useChromeDialog=true;
  452. var A=(screen.height>650)?600:550;
  453. if(C&&C.exists()){C.open(D,700,A)
  454. }else{C.open(D,700,A,"",Klib.BugReporter.initWindow)
  455. }}
  456. }if(!this.JSON){this.JSON=function(){function f(n){return n<10?"0"+n:n
  457. }Date.prototype.toJSON=function(key){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"
  458. };
  459. var escapeable=/["\\\x00-\x1f\x7f-\x9f]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;
  460. function quote(string){return escapeable.test(string)?'"'+string.replace(escapeable,function(a){var c=meta[a];
  461. if(typeof c==="string"){return c
  462. }c=a.charCodeAt();
  463. return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16)
  464. })+'"':'"'+string+'"'
  465. }function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];
  466. if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)
  467. }if(typeof rep==="function"){value=rep.call(holder,key,value)
  468. }switch(typeof value){case"string":return quote(value);
  469. case"number":return isFinite(value)?String(value):"null";
  470. case"boolean":case"null":return String(value);
  471. case"object":if(!value){return"null"
  472. }gap+=indent;
  473. partial=[];
  474. if(typeof value.length==="number"&&!(value.propertyIsEnumerable("length"))){length=value.length;
  475. for(i=0;
  476. i<length;
  477. i+=1){partial[i]=str(i,value)||"null"
  478. }v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";
  479. gap=mind;
  480. return v
  481. }if(rep&&typeof rep==="object"){length=rep.length;
  482. for(i=0;
  483. i<length;
  484. i+=1){k=rep[i];
  485. if(typeof k==="string"){v=str(k,value,rep);
  486. if(v){partial.push(quote(k)+(gap?": ":":")+v)
  487. }}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value,rep);
  488. if(v){partial.push(quote(k)+(gap?": ":":")+v)
  489. }}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";
  490. gap=mind;
  491. return v
  492. }}return{stringify:function(value,replacer,space){var i;
  493. gap="";
  494. indent="";
  495. if(space){if(typeof space==="number"){for(i=0;
  496. i<space;
  497. i+=1){indent+=" "
  498. }}else{if(typeof space==="string"){indent=space
  499. }}}rep=replacer;
  500. if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")
  501. }return str("",{"":value})
  502. },parse:function(text,reviver){var j;
  503. function walk(holder,key){var k,v,value=holder[key];
  504. if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);
  505. if(v!==undefined){value[k]=v
  506. }else{delete value[k]
  507. }}}}return reviver.call(holder,key,value)
  508. }if(/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");
  509. return typeof reviver==="function"?walk({"":j},""):j
  510. }throw new SyntaxError("JSON.parse")
  511. },quote:quote}
  512. }()
  513. }if(Klib.install("Json",0.1)){Klib.Json.decode=function(C){var B=null;
  514. try{B=JSON.parse(C)
  515. }catch(A){if(C){Klib.error("Json : failed to decode",C,A)
  516. }}return B
  517. };
  518. Klib.Json.encode=function(B){var C="";
  519. try{C=JSON.stringify(B)
  520. }catch(A){Klib.error("Json : failed to encode object",B,A)
  521. }return C
  522. }
  523. }if(Klib.install("Pref",0.1)){Klib.Pref.prefs={};
  524. Klib.Pref.initPrefs={};
  525. Klib.Pref.forcedPrefs={};
  526. Klib.Pref.privatePrefs=["User.guid","User.uid","User.password","Privacy.privateUrls","Security.safeSites","Security.sites","Security.urls","cluestats","Update.versions","ClueFrame.installed","ClueFrame.clueOrder","Url.safePages","Security.rules","Security.site","Security.disabledSites"];
  527. Klib.Pref.get=function(A,B){if(A.indexOf("interclue.")==0){return top.interclue.getPref(A,B)
  528. }if(Klib.Pref.forcedPrefs[A]!==undefined){return Klib.Pref.forcedPrefs[A]
  529. }else{if(Klib.Pref.prefs[A]!==undefined){return Klib.Pref.prefs[A]
  530. }else{if(Klib.Pref.initPrefs[A]!==undefined){return Klib.Pref.initPrefs[A]
  531. }else{if(B!==undefined){return B
  532. }else{Klib.warning("Unknown preference ["+A+"]");
  533. return null
  534. }}}}};
  535. Klib.Pref.getInt=function(A,B){B=B||0;
  536. return parseInt(Klib.Pref.get(A,B))
  537. };
  538. Klib.Pref.getFloat=function(A,B){B=B||0;
  539. return parseFloat(Klib.Pref.get(A,B))
  540. };
  541. Klib.Pref.onPrefChanged=function(A){if(typeof A.value=="object"){Klib.Pref.prefs[A.key]=A.value
  542. }else{if(Klib.Pref.initPrefs[A.key]!==undefined&&Klib.Pref.initPrefs[A.key]===A.value){delete Klib.Pref.prefs[A.key]
  543. }else{Klib.Pref.prefs[A.key]=A.value
  544. }}};
  545. Klib.Pref.set=function(B,C){if(B.indexOf("interclue.")==0){if(Klib.Pref.get(B,null)!=C){top.interclue.setPref(B,C);
  546. return true
  547. }else{return false
  548. }}var A=false;
  549. if(typeof C=="object"){var D=Klib.clone(C);
  550. Klib.Pref.prefs[B]=D;
  551. A=true
  552. }else{if(Klib.Pref.get(B,null)!==C){if(Klib.Pref.initPrefs[B]!==undefined&&Klib.Pref.initPrefs[B]===C){delete Klib.Pref.prefs[B];
  553. A=true
  554. }else{Klib.Pref.prefs[B]=C;
  555. A=true
  556. }}}if(Klib.initalized&&A){Klib.GEvent.fire("prefchanged",{key:B,value:C});
  557. Klib.Pref.save()
  558. }return A
  559. };
  560. Klib.Pref.init=function(A,B){Klib.Pref.initPrefs[A]=B
  561. };
  562. Klib.Pref.force=function(A,B){Klib.Pref.forcedPrefs[A]=B
  563. };
  564. Klib.Pref.unforce=function(A){delete Klib.Pref.forcedPrefs[A]
  565. };
  566. Klib.Pref.kill=function(A){if(Klib.Pref.prefs[A]!==undefined){delete Klib.Pref.prefs[A]
  567. }};
  568. Klib.Pref.initElement=function(D){var C=D.getAttribute("preferenceid");
  569. var A=Klib.Pref.get(C);
  570. var B=D.tagName.toLowerCase();
  571. if((B=="input"||B=="img")&&D.type&&D.type=="checkbox"){D.checked=A?true:false
  572. }else{if(B=="input"&&D.type&&D.type=="radio"){D.checked=(D.value==A)?true:false
  573. }else{D.value=A
  574. }}Klib.addEvent(D,"click",Klib.Pref.handleElementClick)
  575. };
  576. Klib.Pref.getEleValue=function(B){if(B.getAttribute("prefValue")){return Klib.format(B.getAttribute("prefValue"))
  577. }else{var A=B.tagName.toLowerCase();
  578. if(A=="input"&&B.type=="checkbox"){return B.checked
  579. }else{if(A=="input"&&B.type=="radio"){return B.checked?B.value:null
  580. }else{return B.value
  581. }}}};
  582. Klib.Pref.handleElementClick=function(A){var D=A.source;
  583. var C=D.getAttribute("preferenceid");
  584. var G=Klib.Pref.getEleValue(D);
  585. var F=D.getAttribute("cluecacheid");
  586. var B=D.getAttribute("preferenceconfirm");
  587. var E=Klib.getWin(D);
  588. if(B){if(D.getAttribute("preferenceUseClueFrameConfirm")&&Klib.ClueFrame.doc&&Klib.ClueFrame.visible){Klib.ClueFrame.alert(B,"Confirm","confirm",0,function(){Klib.Pref.set(C,G);
  589. Klib.Clue.cache.remove(F);
  590. var I=D.getAttribute("preferenceToggleTarget");
  591. if(I){var H=Klib.getDoc(D);
  592. Klib.Toggle.toggleEle($(I,H),"display",false)
  593. }},function(){A.halt()
  594. })
  595. }else{if(E.confirm(B)){Klib.Pref.set(C,G)
  596. }else{A.halt()
  597. }}}else{Klib.Pref.set(C,G)
  598. }};
  599. Klib.Pref.handlePrefLinkClick=function(A){var B=A.source;
  600. var C=B.getAttribute("prefpage");
  601. A.halt();
  602. Klib.Pref.openPrefsWindow(C)
  603. };
  604. Klib.Pref.initDoc=function(D){var A=Klib.getEles("input,select,img,textarea",D);
  605. for(var B=0;
  606. B<A.length;
  607. B++){var C=A[B];
  608. if(C.getAttribute("preferenceid")){Klib.Pref.initElement(C)
  609. }}A=Klib.getEles("a",D);
  610. for(var B=0;
  611. B<A.length;
  612. B++){C=A[B];
  613. if(C.getAttribute("prefpage")){Klib.addEvent(C,"click",Klib.Pref.handlePrefLinkClick)
  614. }}};
  615. Klib.Pref.reset=function(A){var D=Klib.csvToArray(A);
  616. for(var B=0;
  617. B<D.length;
  618. B++){if(D[B].indexOf("*")>-1){var C=Klib.KRegex.strToRegex(D[B]);
  619. for(var E in Klib.Pref.prefs){if(C.test(E)){Klib.Pref.set(E,Klib.Pref.initPrefs[E])
  620. }}}else{Klib.Pref.set(D[B],Klib.Pref.initPrefs[D[B]])
  621. }}};
  622. Klib.Pref.resetAll=function(C){var B=Klib.csvToArray(C);
  623. B.push("Update.lastBuild");
  624. B.push("User.guid");
  625. B.push("User.buildId");
  626. for(var A in Klib.Pref.prefs){if(!Klib.inArray(B,A)){delete Klib.Pref.prefs[A]
  627. }}Klib.Clue.checkEnabled()
  628. };
  629. Klib.Pref.toggle=function(A){var B=!Klib.Pref.get(A);
  630. Klib.Pref.set(A,B);
  631. return B
  632. };
  633. Klib.Pref.append=function(A,B){var C=Klib.Pref.get(A,"");
  634. Klib.Pref.set(A,C+B)
  635. };
  636. Klib.Pref.dump=function(C){var B="\n== Current User Preferences ==\n";
  637. for(var A in Klib.Pref.prefs){if(!Klib.inArray(A,C)){B+=A+"="+Klib.toDebugString(Klib.Pref.prefs[A])+"\n"
  638. }}B+="\n-----------------\n";
  639. return B
  640. };
  641. Klib.Pref.copyUserPrefs=function(D){var C=D?Klib.Pref.privatePrefs:[];
  642. var B={};
  643. for(var A in Klib.Pref.prefs){if(!Klib.inArray(A,C)){B[A]=Klib.Pref.prefs[A]
  644. }}return B
  645. };
  646. Klib.Pref.saveFromWindow=function(){var A=Klib.Windows.InterclueUserPreferences.win.Pref.prefs;
  647. for(var B in A){Klib.Pref.set(B,A[B])
  648. }Klib.Pref.save(true);
  649. Klib.Clue.cache.empty();
  650. Klib.HTMLDoc.cache.empty();
  651. Klib.Clue.currentEle=null;
  652. Klib.Clue.checkEnabled();
  653. Klib.Clue.initPrivateUrls(true);
  654. Klib.User.reset()
  655. };
  656. Klib.Pref.resetFromWindow=function(A){Klib.Pref.resetAll(A);
  657. Klib.Pref.save(true);
  658. Klib.User.reset()
  659. };
  660. Klib.Pref.save=function(){throw Error("Klib.Pref.save not written for "+Klib.platform)
  661. };
  662. Klib.Pref.load=function(){throw Error("Klib.Pref.load not written for "+Klib.platform)
  663. };
  664. Klib.Pref.closeWin=function(){var A=new Klib.KWindow("InterclueUserPreferences");
  665. A.close()
  666. };
  667. Klib.Pref.initPrefsWindow=function(D){var H=D.document;
  668. if(!H){return false
  669. }Klib.Window.loading(H,true);
  670. var E=(H.URL.indexOf("#")>-1)?H.URL.replace(/^[^#]*#/,""):"";
  671. if(Klib.platform=="IEToolbar"){E=(H.origUrl.indexOf("#")>-1)?H.origUrl.replace(/^[^#]*#/,""):""
  672. }if(D.Pref&&D.Pref.save){if(!$("interclue-preferences-dialog-footer",H)){throw Error("Prefs window not loaded yet")
  673. }var A=new Klib.Profiler("initPrefsWindow");
  674. D._=_;
  675. D.Interclue=Klib;
  676. D.Pref.save=Klib.Pref.saveFromWindow;
  677. D.Pref.reset=Klib.Pref.resetFromWindow;
  678. D.Pref.skinUrl=Klib.skinUrl();
  679. D.Pref.donate=Klib.ClueFrame.donate;
  680. A.mark("copied func");
  681. D.Pref.prefs=Klib.merge(Klib.Pref.initPrefs,Klib.Pref.prefs,Klib.Pref.forcedPrefs);
  682. A.mark("copied prefs");
  683. if(Klib.platform!="IEToolbar"){$("interclue-preferencesdialog-buttons",H).innerHTML=Klib.ClueFrame.renderButtonsTable();
  684. if(Klib.Pref.get("CustomButtons.enabled")){$("interclue-preferencesdialog-custombuttons",H).innerHTML=Klib.CustomButtons.renderButtonsTable();
  685. Klib.CustomButtons.initPrefsDoc(H)
  686. }$("interclue-preferencesdialog-statusbar-buttons-block",H).innerHTML=Klib.Toolbar.renderStatusbarButtonsTable();
  687. $("interclue-preferencesdialog-unsafe-wordlist",H).innerHTML=Klib.Security.unsafeWordList.join(", ");
  688. Klib.Locale.initDoc(H)
  689. }A.mark("firefox only");
  690. D.Pref.initEles(H);
  691. D.Sync.initDoc(H);
  692. A.mark("Pref.initEles");
  693. $("ClueFrame-hotKey",H).disabled=!Klib.Pref.get("ClueFrame.hotKey.enabled");
  694. Klib.addEvent($("interclue-preferencesdialog-checkforupdates",H),"click",Klib.Pref.checkForUpdates);
  695. A.mark("add events");
  696. Klib.BugReporter.initDocLinks(H);
  697. A.mark("BugReporter.initDocLinks");
  698. A.mark("getElementsByTagName");
  699. var I=H.getElementsByTagName("a");
  700. A.mark("links = "+I.length);
  701. var F=function(J){Klib.ClueBridge.openUrl(J.source.href,true,true);
  702. J.halt();
  703. return false
  704. };
  705. var B=I.length;
  706. for(var C=0;
  707. C<B;
  708. C++){var G=I[C];
  709. if(G.href&&G.protocol&&G.protocol!="javascript:"){Klib.addEvent(G,"click",F)
  710. }}A.mark("links = "+I.length);
  711. D.Pref.showPanel(E);
  712. A.mark("Pref.showPanel");
  713. Klib.Toggle.initDoc(H,"INPUT");
  714. A.mark("Toggle.initDoc");
  715. $("ClueFrame-sample",H).style.fontFamily=Klib.Pref.init("ClueContent.defaultFont","Arial");
  716. $("ClueFrame-sample",H).style.fontSize=Klib.Pref.get("ClueFrame.contentFontSize",9)+"pt";
  717. D.Klib.keyCodesToString=Klib.keyCodesToString;
  718. D.KeyCodeBox.initDoc(H);
  719. Klib.setTimer(function(){Klib.Window.loading(H,false)
  720. },100);
  721. return true
  722. }else{return false
  723. }};
  724. Klib.Pref.checkForUpdates=function(){var E=Klib.Windows.InterclueUserPreferences.win.document;
  725. var C=$("interclue-preferencesdialog-checkforupdates",E);
  726. var B=$("Update.check.beta",E)?$("Update.check.beta",E).checked:false;
  727. var A=$("Update.check.nightly",E)?$("Update.check.nightly",E).checked:false;
  728. var D=$("Update.check.experimental",E)?$("Update.check.experimental",E).checked:false;
  729. Klib.Update.checkForUpdates(true,C,true,B,A,D)
  730. };
  731. Klib.Pref.openAdvancedPrefsWindow=function(C){if(Klib.User.isLoggedIn(true,Klib.getString("prefs.error.login"))){var B=Klib.baseUrl+"/prefs/preferences.html"+(C?("#"+C):"");
  732. var A=new Klib.KWindow("InterclueUserPreferences");
  733. A.useChromeDialog=true;
  734. if(A.exists()){A.win.focus();
  735. A.win.Pref.showPanel(C)
  736. }else{A.open(B,700,510,"",Klib.Pref.initPrefsWindow)
  737. }}};
  738. Klib.Pref.openPrefsWindow=function(A){Klib.Pref.openAdvancedPrefsWindow(A)
  739. };
  740. Klib.Pref.forceSave=function(){Klib.Pref.save(true)
  741. };
  742. Klib.Pref.startSaveTimer=function(){var A=Klib.Pref.getInt("Prefs.saveInterval",5)*60*1000;
  743. Klib.setInterval("Klib.Pref.save",Klib.Pref.forceSave,A)
  744. };
  745. Klib.Pref.stopSaveTimer=function(){Klib.clearTimer("Klib.Pref.save")
  746. };
  747. if(Klib.GEvent){Klib.GEvent.addEvent("login",Klib.Pref.startSaveTimer);
  748. Klib.GEvent.addEvent("logout",Klib.Pref.stopSaveTimer);
  749. Klib.GEvent.addEvent("windowclose",Klib.Pref.forceSave)
  750. }}Klib.STATIC_CLUE_LIST=["mailto","ftp","aim","news","gopher","irc","torrent","webcal","localFile","scriptingEvent","imageLink","unknownProtocol","isPhishURL","isMalwareURL","siteHound","unsafeUrl","unsafeSite","fileNotFound","imagePreview","tracChangeset","tracTicket","tracWiki","koders","anchor","anchorExternal","amazonProduct","facebookMobile","facebook","theGuardian","trademe","wikipedia","youtubeVideo","bugzilla","summaryRSS","summaryOther","searchResults","ajaxSummariser","secure","insecure","newWindow","openedInOtherTab","archive","audio","css","exe","flac","flash","gimp","greasemonkey","image","javascript","microformatVoteFor","microformatVoteAgainst","microformatVoteAbstain","microformatXFNMe","microformatXFNFriend","microformatXFNSweetheart","microformatXFNColleague","microformatXFNCoworker","microformatXFNMet","microformatXFN","mp3","MSExcel","MSPowerPoint","MSWord","ogg","OOCalc","OODraw","OOImpress","OOMath","OOWriter","pdf","plainText","postscript","quicktime","realaudio","realvideo","syndication","video","wma","wmv","xpi"];
  751. if(Klib.App.requireLogin){Klib.Pref.init("User.uid","")
  752. }else{Klib.Pref.init("User.uid","guest")
  753. }Klib.Pref.init("User.guid","");
  754. Klib.Pref.init("User.buildId","");
  755. Klib.Pref.init("User.name","");
  756. Klib.Pref.init("User.email","");
  757. Klib.Pref.init("User.password","");
  758. Klib.Pref.init("User.website","");
  759. Klib.Pref.init("User.requirePassword",false);
  760. Klib.Pref.init("User.logoutInterval",0);
  761. Klib.Pref.init("User.loginAtStartUp",true);
  762. Klib.Pref.init("User.loginToServer",false);
  763. Klib.Pref.init("User.language","en");
  764. Klib.Pref.init("User.activeTimeout",15);
  765. Klib.Pref.init("User.stats.incomePerHour",50);
  766. Klib.Pref.init("User.allowAnonStats",true);
  767. Klib.Pref.init("Update.checkForUpdates",1);
  768. Klib.Pref.init("Update.lastBuild",0);
  769. Klib.Pref.init("Update.notifyUser",true);
  770. Klib.Pref.init("Update.beta.notifyUser",false);
  771. Klib.Pref.init("Update.lastUpdateTime",0);
  772. Klib.Pref.init("Update.versions",{});
  773. Klib.Pref.force("Update.check.stable",true);
  774. Klib.Pref.init("Update.check.beta",false);
  775. Klib.Pref.init("Update.check.nightly",false);
  776. Klib.Pref.init("Update.check.experimental",false);
  777. Klib.Pref.init("Cache.size",256);
  778. Klib.Pref.init("LinkScent.hoverDelay",100);
  779. Klib.Pref.init("LinkScent.prefetchOnHoverDelay",100);
  780. Klib.Pref.init("LinkScent.maxIconsPerLink",0);
  781. Klib.Pref.init("LinkScent.iconSize","auto");
  782. Klib.Pref.init("LinkScent.outlineOnHover",true);
  783. Klib.Pref.init("LinkScent.enabled",true);
  784. Klib.Pref.init("LinkScent.onPageLoadLinkscentTimeout",5);
  785. Klib.Pref.init("LinkScent.defaultFadeOpacity",0.6);
  786. Klib.Pref.init("LinkScent.fadeTime",1000);
  787. Klib.Pref.init("LinkScent.fadeEnabled",Klib.isFirefox3);
  788. Klib.Pref.init("LinkScent.allowOnInternalLinks",false);
  789. Klib.Pref.init("LinkScent.allowOnPaginationLinks",false);
  790. Klib.Pref.init("LinkScent.allowOnTargetedLinks",false);
  791. Klib.Pref.init("LinkScent.allowTinyIcons",true);
  792. Klib.Pref.init("LinkScent.position.nextLinkOffset",40);
  793. Klib.Pref.init("LinkScent.verticallyAlignCloselyPackedLinks",true);
  794. Klib.Pref.init("LinkScent.tiny.offsetX",2);
  795. Klib.Pref.init("LinkScent.tiny.offsetY",-10);
  796. Klib.Pref.init("LinkScent.tiny.hideDelay",1000);
  797. Klib.Pref.init("LinkScent.prefetchFavicons",true);
  798. Klib.Pref.init("LinkScent.prefetchFaviconsMax",15);
  799. Klib.Pref.init("LinkScent.progressIndicator","cursor");
  800. Klib.Pref.force("LinkScent.navigationalMode","tinyicon");
  801. Klib.Pref.init("Clues.enabled",true);
  802. Klib.Pref.init("LinkScent.showFavIcon",true);
  803. Klib.Pref.init("LinkCursor.offsetX",12);
  804. Klib.Pref.init("LinkCursor.offsetY",16);
  805. Klib.Pref.init("ImageLinks.show","cursor");
  806. Klib.Pref.init("Clue.prefetchEvent","linkhover");
  807. Klib.Pref.init("Clue.prefetchHead",true);
  808. Klib.Pref.init("Clue.prefetchContent",true);
  809. Klib.Pref.init("Clue.prefetchSimilarLinks",true);
  810. Klib.Pref.init("Clue.maxContentLength",128);
  811. Klib.Pref.init("Clue.prefetchTimeout",10);
  812. Klib.Pref.init("Clue.prefetchParseHTML",false);
  813. Klib.Pref.force("Clue.prefetchExternalPages",0);
  814. Klib.Pref.init("Clue.openClueLinksInClueFrame",false);
  815. Klib.Pref.force("Clue.openClueLinksInClueFrame",false);
  816. Klib.Pref.init("Clue.requireClickToClueLinksWithTinyIcons",false);
  817. Klib.Pref.init("InternalNavigationLinks.linkedTextRatio",0.7);
  818. Klib.Pref.init("InternalNavigationLinks.maxWords",4);
  819. Klib.Pref.init("InternalNavigationLinks.maxWordsPerLink",3.5);
  820. Klib.Pref.init("ClueScript.defaultTimeout",10);
  821. Klib.Pref.init("ClueScript.maxRedirects",3);
  822. Klib.Pref.init("Clue.default.linkScent","hide");
  823. Klib.Pref.init("Clue.tracTicket.linkScent","hide");
  824. Klib.Pref.init("Clue.wikipedia.linkScent","fade");
  825. Klib.Pref.force("Clue.ajaxSummariser.showFullPageOnFail",false);
  826. Klib.Pref.init("Clue.ajaxSummariser.wordsPerSummary",0);
  827. Klib.Pref.init("Clue.ajaxSummariser.textToLinkedTextRatio",0.4);
  828. Klib.Pref.init("Clue.ajaxsummariser.nag.interval",20);
  829. Klib.Pref.init("Clue.anchorExternal.minWords",50);
  830. Klib.Pref.init("Clue.imagePreview.maxImageSize",128);
  831. Klib.Pref.init("Clue.textPreview.maxTextSize",2);
  832. Klib.Pref.init("Clue.showThumbnails",true);
  833. Klib.Pref.init("Clue.amazonProduct.enabled",true);
  834. Klib.Pref.init("NanoHint.enabled",false);
  835. Klib.Pref.init("Summary.sendPrefetchRequest",true);
  836. Klib.Pref.init("Summary.sendPrecacheRequests",false);
  837. Klib.Pref.init("Summary.images",true);
  838. Klib.Pref.init("Summary.images.thumbnail.maxWidth",190);
  839. Klib.Pref.init("Summary.images.thumbnail.maxHeight",150);
  840. Klib.Pref.init("Summary.images.minWidth",101);
  841. Klib.Pref.init("Summary.images.minHeight",101);
  842. Klib.Pref.init("Summary.images.internalOnly",false);
  843. Klib.Pref.init("Summary.images.externalImageWhitelist","flickr.com\nimages-amazon.com\nimageshack.us\nphotobucket.com");
  844. Klib.Pref.init("Security.unsafeWords","");
  845. Klib.Pref.init("Security.http.default","enabled");
  846. Klib.Pref.init("Security.https.default","disabled");
  847. Klib.Pref.init("Security.warnAboutUnsafeSites",false);
  848. Klib.Pref.init("Security.sites",{}),Klib.Pref.init("Security.urls",{}),Klib.Pref.init("ClueFrame.width",490);
  849. Klib.Pref.init("ClueFrame.height",350);
  850. Klib.Pref.init("ClueFrame.contentFontSize",9);
  851. Klib.Pref.init("ClueFrame.locked",false);
  852. Klib.Pref.init("ClueFrame.frameMargin",15);
  853. Klib.Pref.init("ClueFrame.lastSelectedClue","");
  854. Klib.Pref.init("ClueFrame.showEvent","hover");
  855. Klib.Pref.init("ClueFrame.hoverDelay",250);
  856. Klib.Pref.init("ClueFrame.linkHoverDelay",500);
  857. Klib.Pref.init("ClueFrame.hideDelay",250);
  858. Klib.Pref.init("ClueFrame.showProcessing",true);
  859. Klib.Pref.init("ClueFrame.showCluescriptId",false);
  860. Klib.Pref.init("ClueFrame.modeSwitchingEnabled",false);
  861. Klib.Pref.init("ClueFrame.frameType","iframe");
  862. Klib.Pref.init("ClueFrame.hotKey.enabled",false);
  863. Klib.Pref.init("ClueFrame.hotKey",[Klib.KEY_CODE_CTRL,Klib.KEY_CODE_SHIFT]);
  864. Klib.Pref.init("ClueFrame.lockedShowEvent","linkhover");
  865. Klib.Pref.init("ClueFrame.allowLocked",true);
  866. Klib.Pref.init("ClueFrame.linkTargetClick","current");
  867. Klib.Pref.init("ClueFrame.linkTargetMiddleClick","background");
  868. Klib.Pref.init("ClueContent.defaultFont","Arial");
  869. Klib.Pref.init("Privacy.addXClueHeaders",true);
  870. Klib.Pref.init("Privacy.privateUrls","https:\n10.*.*.*\n192.168.*.*\n127.0.0.1\nlocalhost");
  871. Klib.Pref.init("Drag.transparency",true);
  872. Klib.Pref.init("PresentationMode.enabled",false);
  873. Klib.Pref.init("PresentationMode.prevLinkKey",[Klib.KEY_CODE_SHIFT,Klib.KEY_CODE_LEFT_ARROW]);
  874. Klib.Pref.init("PresentationMode.nextLinkKey",[Klib.KEY_CODE_SHIFT,Klib.KEY_CODE_RIGHT_ARROW]);
  875. Klib.Pref.init("PresentationMode.prevSimilarLinkKey",[Klib.KEY_CODE_LEFT_ARROW]);
  876. Klib.Pref.init("PresentationMode.nextSimilarLinkKey",[Klib.KEY_CODE_RIGHT_ARROW]);
  877. Klib.Pref.init("ClueFrame.installed",Klib.STATIC_CLUE_LIST);
  878. Klib.Pref.init("ClueFrame.clueOrder",Klib.STATIC_CLUE_LIST);
  879. Klib.Pref.init("Fade.linkscent",500);
  880. Klib.Pref.init("QFS.enabled",false);
  881. Klib.Pref.init("Messages.show",true);
  882. Klib.Pref.init("hint.linkscentmode.https.show",true);
  883. Klib.Pref.init("hint.linkscentmode.unavailable.show",true);
  884. Klib.Pref.init("hint.linkcursor.tinyicon.show",true);
  885. Klib.Pref.init("Debug.statusbar.visible",false);
  886. Klib.Pref.init("clueserver","https://interclue.com");
  887. Klib.Pref.init("ToolbarButton.currentpage.location","");
  888. Klib.Pref.init("ToolbarButton.referrerpage.location","");
  889. Klib.Pref.force("ToolbarButton.tutorial.location","statusbarmenu");
  890. Klib.Pref.force("ToolbarButton.options.location","statusbarmenu");
  891. Klib.Pref.force("ToolbarButton.stats.location","statusbarmenu");
  892. Klib.Pref.force("ToolbarButton.changelog.location","statusbarmenu");
  893. Klib.Pref.init("ToolbarButton.bugreport.location","statusbarmenu");
  894. Klib.Pref.force("ToolbarButton.visitwebsite.location","statusbarmenu");
  895. Klib.Pref.force("ToolbarButton.donate.location","statusbarmenu");
  896. Klib.Pref.force("ToolbarButton.updatecheck.location","statusbarmenu");
  897. Klib.Pref.init("ToolbarButton.debuglog.location","");
  898. Klib.Pref.force("ToolbarButton.buttoneditor.location","statusbarmenu");
  899. Klib.Pref.force("ToolbarButton.buttonload.location","statusbarmenu");
  900. Klib.Pref.force("ToolbarButton.about.location","statusbarmenu");
  901. Klib.Pref.init("Stats.clueCount.Period",1);
  902. Klib.Pref.init("Stats.clueCount.Interval","month");
  903. Klib.Pref.init("Stats.clueCount.max",1001);
  904. Klib.Pref.force("Stats.clueCount.showInStatusbar",false);
  905. Klib.Pref.init("Button.history.showInTitlebar",false);
  906. Klib.Pref.init("Button.linkNavigation.showInTitlebar",false);
  907. Klib.Pref.init("Button.linkNavigationSimilar.showInTitlebar",true);
  908. Klib.Pref.init("Button.bookmark.showInTitlebar",true);
  909. Klib.Pref.init("Button.followCurrentLinkNewTab.showInTitlebar",true);
  910. Klib.Pref.init("Button.followCurrentLinkNewTabFocus.showInTitlebar",false);
  911. Klib.Pref.init("Button.followCurrentLink.showInTitlebar",false);
  912. Klib.Pref.init("Button.selectTabForLink.showInTitlebar",true);
  913. Klib.Pref.init("Button.sendTo.showInTitlebar",true);
  914. Klib.Pref.init("Button.copyToClipboard.showInTitlebar",true);
  915. Klib.Pref.init("Button.copyLinkUrlToClipboard.showInTitlebar",false);
  916. Klib.Pref.init("Button.refresh.showInTitlebar",false);
  917. Klib.Pref.init("Button.fontsizeIncrease.showInTitlebar",false);
  918. Klib.Pref.init("Button.fontsizeDecrease.showInTitlebar",false);
  919. Klib.Pref.init("Button.options.showInTitlebar",true);
  920. Klib.Pref.init("Button.reddit.showInTitlebar",false);
  921. Klib.Pref.init("Button.facebookBookmark.showInTitlebar",false);
  922. Klib.Pref.init("Button.summaryImagesEnable.showInTitlebar",false);
  923. Klib.Pref.init("Button.turboNote.showInTitlebar",true);
  924. Klib.Pref.init("Button.print.showInTitlebar",false);
  925. Klib.Pref.init("Button.bugReport.showInTitlebar",true);
  926. Klib.Pref.init("Button.badSummaryReport.showInTitlebar",true);
  927. Klib.Pref.init("Button.delicious.showInTitlebar",false);
  928. Klib.Pref.init("Button.digg.showInTitlebar",false);
  929. Klib.Pref.init("Button.googleBookmark.showInTitlebar",false);
  930. Klib.Pref.init("Button.newsvineSeed.showInTitlebar",false);
  931. Klib.Pref.init("Button.yahooMyWeb.showInTitlebar",false);
  932. Klib.Pref.init("Button.stumbleUpon.showInTitlebar",false);
  933. Klib.Pref.init("Button.windowsLive.showInTitlebar",false);
  934. Klib.Pref.init("Button.donate.showInTitlebar",true);
  935. Klib.Pref.init("Button.lock.showInTitlebar",true);
  936. Klib.Pref.init("Button.close.showInTitlebar",false);
  937. Klib.Pref.init("Button.debugSummary.showInTitlebar",false);
  938. Klib.Pref.force("CustomButtons.enabled",false);
  939. Klib.Pref.init("Thumbnails.providerId","thumbshots");
  940. Klib.Pref.init("Thumbnails.prefetch",true);
  941. Klib.Pref.init("Metadata.thumbnails.enabled",true);
  942. Klib.Pref.init("Metadata.thumbnails.enabled",true);
  943. Klib.Pref.init("Metadata.thumbnails.minimize",false);
  944. Klib.Pref.init("Metadata.pageStats.enabled",true);
  945. Klib.Pref.init("Metadata.pageStats.minimize",false);
  946. Klib.Pref.init("Metadata.microsummary.enabled",false);
  947. Klib.Pref.init("Metadata.microsummary.minimize",false);
  948. Klib.Pref.init("Metadata.downloadableFiles.enabled",true);
  949. Klib.Pref.init("Metadata.downloadableFiles.minimize",false);
  950. Klib.Pref.init("Metadata.downloadableFiles.maxFilesToShow",5);
  951. Klib.Pref.init("Metadata.published.enabled",true);
  952. Klib.Pref.init("Metadata.published.minimize",false);
  953. Klib.Pref.init("Metadata.delicious.enabled",true);
  954. Klib.Pref.init("Metadata.delicious.minimize",false);
  955. Klib.Pref.init("Metadata.delicious.type","cloud");
  956. Klib.Pref.init("Metadata.delicious.maxListItems",5);
  957. Klib.Pref.init("Metadata.digg.enabled",false);
  958. Klib.Pref.init("Metadata.digg.minimize",false);
  959. Klib.Pref.init("Metadata.languageInfo.enabled",false);
  960. Klib.Pref.init("Metadata.languageInfo.minimize",false);
  961. Klib.Pref.init("Metadata.feeds.enabled",true);
  962. Klib.Pref.init("Metadata.feeds.minimize",false);
  963. Klib.Pref.force("Metadata.authorInfo.enabled",false);
  964. Klib.Pref.init("Metadata.authorInfo.minimize",false);
  965. Klib.Pref.force("Metadata.siteInfo.enabled",false);
  966. Klib.Pref.init("Metadata.siteInfo.minimize",false);
  967. Klib.Pref.init("Metadata.privacyWarning.enabled",true);
  968. Klib.Pref.init("Metadata.privacyWarning.minimize",false);
  969. Klib.Pref.init("Metadata.addRemove.enabled",true);
  970. Klib.Pref.init("Debug.showDebugLogOnLogin",false);
  971. Klib.Pref.init("Debug.showWarningsForMissingTranslations",false);
  972. Klib.Pref.init("Debug.profileHTMLParser",false);
  973. Klib.Pref.init("Flash.setModeToTransparent",true);
  974. Klib.Pref.init("Parser.maxTimeToParse",4);
  975. Klib.Pref.init("Changelog.showOnUpdate",false);
  976. Klib.Pref.init("BugReporter.showTranslationPanel",false);
  977. Klib.Pref.init("BugReporter.emailAboutBug",false);
  978. Klib.Pref.init("BugReporter.emailWhenFixed",false);
  979. Klib.Pref.init("Browser.minimumWidth",400);
  980. Klib.Pref.init("Browser.minimumHeight",400);
  981. Klib.Pref.init("Prefs.saveInterval",5);
  982. Klib.Pref.force("clueserver","https://interclue.com");
  983. Klib.Pref.force("ClueFrame.installed",Klib.STATIC_CLUE_LIST);
  984. Klib.Pref.force("ClueFrame.clueOrder",Klib.STATIC_CLUE_LIST);
  985. Klib.Pref.force("ClueFrame.modeSwitchingEnabled",false);
  986. Klib.Pref.force("ClueFrame.frameType","iframe");
  987. Klib.Pref.force("Summary.showActionButtons",false);
  988. Klib.Pref.force("Privacy.addXClueHeaders",false);
  989. Klib.Pref.force("LinkScent.iconSize","normal");
  990. if(Klib.App.subName==""){Klib.Pref.force("BugReporter.showTranslationPanel",false)
  991. }if(Klib.isIE){Klib.Pref.force("LinkScent.fadeEnabled",false)
  992. }if(Klib.install("User",0.1)){Klib.User.uid="";
  993. Klib.User.lastScreenX=0;
  994. Klib.User.lastScreenY=0;
  995. Klib.User.winPrefs=null;
  996. Klib.User.contactedServer=function(A){Klib.User.loginMessage(Klib.getString("login.connected.to.server"),true,true);
  997. return true
  998. };
  999. Klib.User.loginAtStartup=function(){if(Klib.platform=="firefox"){try{if(top.document.getElementById("navigator-toolbox").boxObject.height===0){return false
  1000. }}catch(A){}}if(!Klib.User.winLoggedIn&&Klib.ClueFrame.isWindowLargeEnough()){if(Klib.Global.get("loggedIn")&&Klib.Global.get("uid")){Klib.GEvent.fireLocal("login",Klib.Global.get("uid"));
  1001. return true
  1002. }else{if(Klib.Pref.get("User.loginAtStartUp")||Klib.platform=="IEToolbar"){Klib.User.attemptLogin();
  1003. return true
  1004. }}}return false
  1005. };
  1006. Klib.User.processServerLogin=function(A){if(A.error||!A.json){Klib.User.loginError(Klib.getString("invalid.server.response"),"");
  1007. Klib.error(A.error,A.json);
  1008. Klib.Windows.InterclueUserLogin.win.focus()
  1009. }else{if(!A.json.uid){var B=(A.json.error.toLowerCase().indexOf("password")>-1)?"User.password":"User.name";
  1010. Klib.User.loginError(A.json.error,B)
  1011. }else{Klib.User.loginMessage(Klib.getString("login.logging.in"),true,false);
  1012. Klib.Pref.set("User.uid",A.json.uid);
  1013. Klib.Pref.set("User.name",A.json.name);
  1014. Klib.Pref.set("User.lastLoginName",A.json.name);
  1015. Klib.Pref.set("User.password",A.json.password);
  1016. Klib.User.logout();
  1017. Klib.User.login(A.json.uid,"process login");
  1018. Klib.Windows.InterclueUserLogin.close()
  1019. }}};
  1020. Klib.User.processLoginAttempt=function(A){A.halt();
  1021. var F=Klib.Windows.InterclueUserLogin.win.document;
  1022. var D=Klib.trim($("User.name",F).value);
  1023. var C=Klib.trim($("User.password",F).value);
  1024. if(!D){Klib.User.loginError(Klib.getString("login.error.name.required"),"User.name")
  1025. }else{if(!C){Klib.User.loginError(Klib.getString("login.error.password.required"),"User.password")
  1026. }else{if((D.toLowerCase()==Klib.Pref.get("User.name","").toLowerCase())&&(C==Klib.Pref.get("User.password",""))){Klib.Pref.set("User.lastLoginName",D);
  1027. Klib.Pref.set("User.name",D);
  1028. Klib.Pref.set("User.password",C);
  1029. Klib.User.loginMessage(Klib.getString("login.logging.in"),false,false);
  1030. Klib.User.login(Klib.Pref.get("User.uid",""),"process login");
  1031. Klib.Windows.InterclueUserLogin.close()
  1032. }else{var B=Klib.getString("url.user.login");
  1033. var E=new Klib.Ajax.Obj(B);
  1034. E.isJson=true;
  1035. E.onComplete=Klib.User.processServerLogin;
  1036. E.onHead=Klib.User.contactedServer;
  1037. E.addData("username",D);
  1038. E.addData("password",C);
  1039. E.send();
  1040. Klib.User.loginMessage(Klib.getString("login.connecting.to.server"),true,true)
  1041. }}}};
  1042. Klib.User.loginError=function(C,A){var B=Klib.Windows.InterclueUserLogin.win.document;
  1043. Klib.replaceClass($("status-messages",B),"status-loading,status-normal","status-error");
  1044. $("status-messages",B).innerHTML=C;
  1045. A=A||"User.password";
  1046. $("User.password",B).value="";
  1047. $(A,B).select();
  1048. $("button-login",B).disabled=false
  1049. };
  1050. Klib.User.loginMessage=function(C,D,A){var B=Klib.Windows.InterclueUserLogin.win.document;
  1051. $("status-messages",B).innerHTML=C;
  1052. if(D){Klib.replaceClass($("status-messages",B),"status-error,status-normal","status-loading")
  1053. }else{Klib.replaceClass($("status-messages",B),"status-error,status-loading","status-normal")
  1054. }$("button-login",B).disabled=A?true:false
  1055. };
  1056. Klib.User.initLoginWindow=function(C){var B=C.document;
  1057. if(!B){return false
  1058. }Klib.Window.loading(B,true);
  1059. var A=Klib.Pref.get("User.name","");
  1060. $("User.name",B).value=A;
  1061. if(A){$("User.password",B).select()
  1062. }else{$("User.name",B).select()
  1063. }Klib.addEvent($("form-login",B),"submit",Klib.User.processLoginAttempt);
  1064. Klib.translate(B);
  1065. Klib.Window.loading(B,false);
  1066. return true
  1067. };
  1068. Klib.User.attemptLogin=function(B){var A=Klib.Pref.get("User.uid");
  1069. if(!Klib.App.requireLogin){A=A||"guest";
  1070. Klib.User.login(A,"autoLogin");
  1071. return true
  1072. }else{if(A&&!Klib.Pref.get("User.requirePassword")){Klib.User.login(A,"Klib.User.attemptLogin");
  1073. return true
  1074. }else{if(B){Klib.User.showLogin();
  1075. return false
  1076. }else{return false
  1077. }}}};
  1078. Klib.User.showLogin=function(){var A=Klib.baseUrl+"/login/login.html";
  1079. var B=new Klib.KWindow("InterclueUserLogin");
  1080. B.useChromeDialog=true;
  1081. B.open(A,300,150,"",Klib.User.initLoginWindow)
  1082. };
  1083. Klib.User.isLoggedIn=function(A,B){if(!Klib.initalized){return false
  1084. }else{if(Klib.Global.get("loggedIn")){return true
  1085. }else{if(A&&(!Klib.App.requireLogin||!B||confirm(B))){return Klib.User.attemptLogin(true)
  1086. }else{return false
  1087. }}}};
  1088. Klib.User.generateGuid=function(){return Klib.md5(Klib.timestamp(true)+":"+Math.random())
  1089. };
  1090. Klib.User.getGuid=function(){var A=Klib.Pref.get("User.guid");
  1091. if(!A){A=Klib.User.generateGuid();
  1092. Klib.Pref.set("User.guid",A)
  1093. }return A
  1094. };
  1095. Klib.User.handleLogin=function(){Klib.User.winLoggedIn=true;
  1096. Klib.User.uid=Klib.Global.get("uid","");
  1097. Klib.Pref.load();
  1098. Klib.Toolbar.refresh();
  1099. Klib.ClueBridge.init();
  1100. Klib.setInterval("checkWindows",Klib.ClueBridge.checkWindows,200);
  1101. Klib.Stats.start()
  1102. };
  1103. Klib.User.login=function(A,B){Klib.Pref.set("User.uid",A);
  1104. Klib.Pref.set("User.loginAtStartUp",true);
  1105. Klib.User.getGuid();
  1106. if(!Klib.Pref.get("User.buildId")){Klib.Pref.set("User.buildId",Klib.App.buildId)
  1107. }Klib.Global.set("uid",A);
  1108. Klib.Global.set("loggedIn",true);
  1109. Klib.GEvent.fire("login",A)
  1110. };
  1111. Klib.User.resetLogoutTimer=function(){Klib.User.lastMoved=Klib.timestamp()
  1112. };
  1113. Klib.User.tick=function(){if(Klib.Global.get("loggedIn")&&(Klib.Pref.getInt("User.logoutInterval",0)>0)){var A=Klib.timestamp();
  1114. if((Klib.User.lastScreenX==Klib.Mouse.screenX)&&(Klib.User.lastScreenY==Klib.Mouse.screenY)){if(A>(Klib.User.lastMoved+(Klib.Pref.get("User.logoutInterval",30)*60))){Klib.User.logout("Klib.User.tick")
  1115. }}else{Klib.User.lastScreenX=Klib.Mouse.screenX;
  1116. Klib.User.lastScreenY=Klib.Mouse.screenY;
  1117. Klib.User.lastMoved=A
  1118. }}};
  1119. Klib.User.handleLogout=function(){Klib.User.winLoggedIn=false;
  1120. Klib.Stats.save();
  1121. Klib.ClueBridge.cleanUpAllDocs();
  1122. Klib.Toolbar.refresh()
  1123. };
  1124. Klib.User.logout=function(B,A){if(!A){Klib.Pref.set("User.loginAtStartUp",false)
  1125. }Klib.Global.set("loggedIn",false);
  1126. Klib.GEvent.fire("logout")
  1127. };
  1128. Klib.User.reset=function(){var A=Klib.Global.get("uid","");
  1129. Klib.User.resetting=true;
  1130. Klib.User.logout("resetting");
  1131. Klib.User.login(A,"resetting");
  1132. Klib.Pref.load();
  1133. Klib.User.resetting=false
  1134. };
  1135. Klib.User.winFeatureRequest=null
  1136. }if(Klib.install("Iframe",0.1)){Klib.Iframe.create=function(B,G,I,E,H){var F=G.ownerDocument;
  1137. var D=F.createElement("iframe");
  1138. D.id=B;
  1139. D.setAttribute("id",B);
  1140. D.name=B;
  1141. D.scrolling="auto";
  1142. D.frameBorder=0;
  1143. D.border=0;
  1144. if(Klib.isIE&&I){D.allowTransparency=true
  1145. }D.style.position="absolute";
  1146. if(E){for(var A in E){D[A]=E[A]
  1147. }}if(H){for(var C in H){D.style[C]=H[C]
  1148. }}if(Klib.isIE){D.src=""
  1149. }else{if(Klib.isSafari){D.src="about:blank"
  1150. }else{D.setAttribute("src","javascript: void(0);")
  1151. }}G.appendChild(D);
  1152. return D
  1153. };
  1154. Klib.Iframe.init=function(B,C,A){C=C||function(){};
  1155. A=(A===undefined)?10:A;
  1156. if(B.contentDocument){B.doc=B.contentDocument
  1157. }else{if(B.contentWindow&&B.contentWindow.document){B.doc=B.contentWindow.document
  1158. }}if(B.doc&&B.doc.body){B.win=Klib.getWin(B.doc);
  1159. C(B)
  1160. }else{if(A>0){A--;
  1161. Klib.setTimer(function(){Klib.Iframe.init(B,C,A)
  1162. },200)
  1163. }else{Klib.fatal("Unable to initalise iframe document",B,B.contentDocument,B.doc,C.toString())
  1164. }}};
  1165. Klib.Iframe.createShim=function(A){var C=Klib.Iframe.create(A.id+"-shim",A.parentNode,false);
  1166. A.shim=C;
  1167. C.iframe=A;
  1168. C.style.position=A.style.position;
  1169. C.style.width=A.style.width;
  1170. C.style.height=A.style.height;
  1171. C.style.zIndex=Klib.getStyle(A,"zIndex","int")-1;
  1172. try{C.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0, opacity=0)"
  1173. }catch(B){}Klib.addEvent(A,"move",Klib.Iframe.repositionShim);
  1174. Klib.addEvent(A,"resize",Klib.Iframe.repositionShim)
  1175. };
  1176. Klib.Iframe.repositionShim=function(A){var B=A.source;
  1177. var C=B.shim;
  1178. if(C){C.style.left=B.style.left;
  1179. C.style.top=B.style.top;
  1180. C.style.width=B.style.width;
  1181. C.style.height=B.style.height;
  1182. C.style.visiblity="visible";
  1183. C.style.display="block"
  1184. }};
  1185. Klib.makeEmbeddedWindowsTransparent=function(C){C=C||document;
  1186. var D=Klib.getEles("object",C);
  1187. for(var A=0;
  1188. A<D.length;
  1189. A++){try{D[A].WMode="transparent"
  1190. }catch(B){}}}
  1191. }if(Klib.install("Misc",0.1)){Klib.textToRTF=function(D){D=D.replace(/([\\\{\}])/g,"\\$1");
  1192. D=D.replace(/\n/g,"\\par ");
  1193. var A="{\\rtf1 ";
  1194. for(var C=0;
  1195. C<D.length;
  1196. C++){var B=D.charCodeAt(C);
  1197. if(B>127){A+="\\u"+B+"?"
  1198. }else{A+=D.substr(C,1)
  1199. }}A+="}";
  1200. return A
  1201. };
  1202. Klib.decodeURI=function(A){try{A=decodeURIComponent(A)
  1203. }catch(B){}return A
  1204. };
  1205. Klib.keysTolowerCase=function(A){var B={};
  1206. for(var C in A){B[C.toLowerCase()]=A[C]
  1207. }return B
  1208. };
  1209. Klib.substitute=function(H,E,B){E=Klib.keysTolowerCase(E);
  1210. var F="";
  1211. if(E[0]){for(var A=0;
  1212. A<E.length;
  1213. A++){F+=Klib.substitute(H,E[A],B)
  1214. }}else{var D=H.match(/\{\w+\}/g);
  1215. F=H;
  1216. if(D){for(var C=0;
  1217. C<D.length;
  1218. C++){var I=D[C].replace(/\{|\}/g,"").toLowerCase();
  1219. var G=new RegExp("\\{"+I+"\\}","ig");
  1220. if(E[I]){F=F.replace(G,E[I])
  1221. }}if(!B){F=F.replace(/\{\w+\}/g,"")
  1222. }}}return F
  1223. };
  1224. Klib.htmlspecialchars=function(B,A){B=B||"";
  1225. B=B.toString();
  1226. if(A){B=B.replace(/&/g,"&")
  1227. }else{B=B.replace(/&(?!(\w+|#\d+);?)/g,"&")
  1228. }B=B.replace(/"/g,""");
  1229. B=B.replace(/'/g,"'");
  1230. B=B.replace(/</g,"<");
  1231. B=B.replace(/>/g,">");
  1232. return B
  1233. };
  1234. Klib.byteSize=function(B,E){E=E||0;
  1235. B=(B)?parseInt(B):0;
  1236. var D=["b","Kb","Mb","Gb","Tb","Pb","Eb"];
  1237. var F=1024;
  1238. var G="";
  1239. for(var C=0;
  1240. C<D.length;
  1241. C++){var A=Math.pow(F,C+1);
  1242. if(B<A){G=Klib.round(B/(A/F),E,true);
  1243. G+=" "+D[C];
  1244. break
  1245. }}return G
  1246. };
  1247. Klib.wordCount=function(D,A){var B=(A)?Klib.Html.stripTags(D):Klib.trim(D);
  1248. var C=B.match(/[\w-_\.]+/g);
  1249. return(C)?C.length:0
  1250. };
  1251. Klib.clearBackground=function(A){Klib.setBackground(A,"")
  1252. };
  1253. Klib.setBackground=function(C,D,B){C.backgroundImageSrc=C.backgroundImageSrc||"";
  1254. var A=D?('background: transparent url("'+D+'") no-repeat center center !important;'):"background-image : none !important";
  1255. if(B){A=A.replace("no-repeat center center",B)
  1256. }if(C.backgroundImageSrc!=D){C.backgroundImageSrc=D;
  1257. Klib.addCSS(C,A);
  1258. return true
  1259. }else{return false
  1260. }};
  1261. Klib.percent=function(B,A){A=A||0;
  1262. if(A==-1){return parseInt(B*100)
  1263. }else{return Klib.round(B*100,A,true)
  1264. }};
  1265. Klib.datestamp=function(A){A=A||new Date();
  1266. return(A.getFullYear()+"/"+Klib.pad(A.getMonth()+1,2)+"/"+Klib.pad(A.getDate(),2))
  1267. };
  1268. Klib.daysSinceEpoch=function(A){if(!A){var B=new Date();
  1269. A=new Date(Klib.datestamp(B))
  1270. }A=A||new Date();
  1271. return parseInt(A.getTime()/(1000*60*60*24))
  1272. };
  1273. Klib.formatTime=function(E,C){C=C||"h:m:s";
  1274. E=parseInt(E);
  1275. if(!E){return"-"
  1276. }var A=parseInt(E/(60*60));
  1277. E=E-(A*60*60);
  1278. var B=parseInt(E/(60));
  1279. E=E-(B*60);
  1280. B=Klib.pad(B,2);
  1281. E=parseInt(E);
  1282. E=Klib.pad(E,2);
  1283. var D=C.replace(/h/,A);
  1284. D=D.replace(/m/,B);
  1285. D=D.replace(/s/,E);
  1286. return D
  1287. };
  1288. Klib.formatDate=function(B,F){var A=Klib.getString("date.months").split(/[\s\,]+/g);
  1289. var G=F||"d-M-Y";
  1290. var E="";
  1291. for(var C=0;
  1292. C<G.length;
  1293. C++){var D=G.substr(C,1);
  1294. switch(D){case"j":E+=B.getDate();
  1295. break;
  1296. case"d":E+=Klib.pad(B.getDate(),2);
  1297. break;
  1298. case"n":E+=(B.getMonth()+1);
  1299. break;
  1300. case"m":E+=Klib.pad(B.getMonth()+1,2);
  1301. break;
  1302. case"F":E+=A[B.getMonth()];
  1303. break;
  1304. case"M":E+=A[B.getMonth()].substr(0,3);
  1305. break;
  1306. case"Y":E+=B.getFullYear();
  1307. break;
  1308. case"y":E+=B.getFullYear().toString().substr(2);
  1309. break;
  1310. default:E+=D;
  1311. break
  1312. }}return E
  1313. };
  1314. Klib.parseDate=function(B){var C;
  1315. var A=B.match(/^\s*(\d{4})\-(\d{2})\-(\d{2})\s*T\s*((\d{2}):(\d{2}):(\d{2}))?/i);
  1316. if(A){if(A[4]){C=new Date(A[1],A[2],A[3],A[5],A[6],A[7])
  1317. }else{C=new Date(A[1],A[2],A[3])
  1318. }}else{C=new Date(B)
  1319. }if(isNaN(C.getTime())||C.getTime()==0){return null
  1320. }else{return C
  1321. }};
  1322. Klib.getDate=function(D,C){var B=new Date(D);
  1323. if(!B){return null
  1324. }var A=B.getTime();
  1325. if(isNaN(A)||A==0){return null
  1326. }else{if(C&&C.getTime()<A){return null
  1327. }else{return B
  1328. }}};
  1329. Klib.strTruncate=function(C,B,A){A=A||"...";
  1330. if(C.length>B){return C.substr(0,B-A.length)+A
  1331. }else{return C
  1332. }};
  1333. Klib.textToHtml=function(A){A="<p>"+Klib.htmlspecialchars(Klib.trim(A))+"</p>";
  1334. A=A.replace(/\s*[\r\f]\s*[\r\f]\s*/g,"</p><p>");
  1335. A=A.replace(/\s*\n\s*/g,"<br />");
  1336. A=A.replace(/\s+/g," ");
  1337. return A
  1338. };
  1339. Klib.isHTMLHeader=function(B){var A=B.content_type?B.content_type:B;
  1340. return(A.match(/text\/html/i)||A.match(/application\/xhtml/i)||A.match(/magnus\-internal\/parsed\-html/i))?true:false
  1341. };
  1342. Klib.keyCodesToString=function(D){var A=[];
  1343. for(var C=0;
  1344. C<D.length;
  1345. C++){var B=parseInt(D[C]);
  1346. switch(B){case 16:A.push("[shift]");
  1347. break;
  1348. case 17:A.push("[ctrl]");
  1349. break;
  1350. case 18:A.push("[alt]");
  1351. break;
  1352. case 37:A.push("[left arrow]");
  1353. break;
  1354. case 38:A.push("[up arrow]");
  1355. break;
  1356. case 39:A.push("[right arrow]");
  1357. break;
  1358. case 40:A.push("[down arrow]");
  1359. break;
  1360. default:if(B>=65&&B<=90){A.push(String.fromCharCode(B))
  1361. }break
  1362. }}return A.join(" + ")
  1363. };
  1364. Klib.getPluginInfo=function(A){var D=null;
  1365. if(navigator.plugins&&navigator.plugins.length){for(var B=0;
  1366. B<navigator.plugins.length;
  1367. B++){var C=navigator.plugins[B];
  1368. if(C.name.toLowerCase().indexOf(A)>-1){if(!C.version&&(matches=C.name.match(/\d+[\.\d]*/))){C.version=matches[0]
  1369. }if(!D||Klib.versionCompare(D.version,"<",C.version)){D=C
  1370. }}}}return D
  1371. };
  1372. Klib.versionCompare=function(B,I,H){var C=B.split(/\./g);
  1373. var A=H.split(/\./g);
  1374. var E=(C.length>A.length)?C.length:A.length;
  1375. var J="";
  1376. for(var D=0;
  1377. D<E;
  1378. D++){var G=C[D]?parseInt(C[D]):0;
  1379. var F=A[D]?parseInt(A[D]):0;
  1380. if(G>F){J=">";
  1381. break
  1382. }else{if(G<F){J="<";
  1383. break
  1384. }}}if(!J){J="="
  1385. }return(I.indexOf(J)>-1)
  1386. };
  1387. Klib.getDocScroll=function(A){return{top:A.body.scrollTop+(A.documentElement.scrollTop?A.documentElement.scrollTop:0),left:A.body.scrollLeft+(A.documentElement.scrollLeft?A.documentElement.scrollLeft:0)}
  1388. };
  1389. Klib.wrapTextNode=function(H,S,O,J){var C=1;
  1390. var P=3;
  1391. var D=0;
  1392. var R=H.ownerDocument;
  1393. var B=new RegExp("\\b("+Klib.escapeRegExStr(S)+")\\b","i");
  1394. for(var N=H.childNodes.length-1;
  1395. N>=0;
  1396. N--){var K=H.childNodes[N];
  1397. if(K.nodeType==C){D+=Klib.wrapTextNode(K,S,O,J)
  1398. }else{if(K.nodeType==P){if(B.test(K.data)){var I=K.data;
  1399. var G=[];
  1400. while(1){var L=I.match(B);
  1401. if(!L){break
  1402. }var E=I.indexOf(L[0]);
  1403. G.push(R.createTextNode(I.substr(0,E)));
  1404. var F=R.createElement(O);
  1405. for(var Q in J){F[Q]=J[Q]
  1406. }var A=R.createTextNode(L[0]);
  1407. F.appendChild(A);
  1408. G.push(F);
  1409. I=I.substr(E+L[0].length);
  1410. D++
  1411. }G.push(R.createTextNode(I));
  1412. for(var M=0;
  1413. M<G.length;
  1414. M++){H.insertBefore(G[M],K)
  1415. }H.removeChild(K)
  1416. }}}}return D
  1417. };
  1418. Klib.isEmail=function(A){A=A.toString();
  1419. return/^[A-Z0-9\._%+-]+@[A-Z0-9\.-]+\.[A-Z]{2,6}$/i.test(A)
  1420. };
  1421. Klib.ipToInt=function(B){var A=B.match(/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/);
  1422. if(A){return parseInt(A[1])*(256*256*256)+parseInt(A[2])*(256*256)+parseInt(A[3])*(256)+parseInt(A[4])
  1423. }else{return 0
  1424. }};
  1425. Klib.xpath=function(D,E){var B=D.createNSResolver(D.ownerDocument==null?D.documentElement:D.ownerDocument.documentElement);
  1426. var A=D.evaluate(E,D,B,XPathResult.ANY_TYPE,null);
  1427. switch(A.resultType){case XPathResult.STRING_TYPE:return A.stringValue;
  1428. case XPathResult.NUMBER_TYPE:return A.numberValue;
  1429. case XPathResult.BOOLEAN_TYPE:return A.booleanValue;
  1430. default:var C=[];
  1431. while(node=A.iterateNext()){C.push(node)
  1432. }return C
  1433. }}
  1434. }if(Klib.install("Cache",0.1)){Klib.Caches={};
  1435. Klib.Cache.rebuildAll=function(C){C=C||256;
  1436. for(var B in Klib.Caches){var A=Klib.Caches[B];
  1437. A.maxEntries=C;
  1438. A.empty()
  1439. }};
  1440. Klib.Cache.resetAll=function(A){if(A===true){alert("== Interclue: Clearing Caches ===\n\n"+Klib.Cache.listStats())
  1441. }Klib.Cache.rebuildAll(Klib.Pref.get("Cache.size",256))
  1442. };
  1443. Klib.Cache.listStats=function(){var C="\n=== Caches ===\n";
  1444. for(var B in Klib.Caches){var A=Klib.Caches[B];
  1445. var E=0;
  1446. for(var D in A.items){E++
  1447. }C+=E+" (of "+A.maxEntries+") items in "+A.name+"\n"
  1448. }return C
  1449. };
  1450. Klib.Cache.Obj=function(A,B){var C=this;
  1451. C.name=A;
  1452. C.maxEntries=B||256;
  1453. C.items={};
  1454. C.index=[];
  1455. C.add=function(D,G,F){if(typeof (C.items[D])==="undefined"||C.items[D]===null){}else{C.index=Klib.arrayRemove(C.index,D);
  1456. if(F){Klib.warning(Error("Object ["+D+"] already exists in cache"),D,G)
  1457. }}C.items[D]=G;
  1458. C.index.push(D);
  1459. if(C.index.length>C.maxEntries){var E=C.index.shift();
  1460. delete C.items[E]
  1461. }};
  1462. C.remove=function(D){if(C.exists(D)){delete C.items[D];
  1463. Klib.arrayRemove(C.index,D)
  1464. }};
  1465. C.get=function(D){return(C.items[D]===undefined)?null:C.items[D]
  1466. };
  1467. C.exists=function(D){return(C.items[D]!==undefined)
  1468. };
  1469. C.empty=function(){for(var D in C.items){delete C.items[D]
  1470. }C.items={};
  1471. C.index=[]
  1472. };
  1473. Klib.Caches[C.name]=C
  1474. };
  1475. Klib.fnv1a=function(I){var A=16777619;
  1476. var D=2166136261;
  1477. var F;
  1478. var G="";
  1479. var C=4294967296;
  1480. var E;
  1481. var J=I.length;
  1482. for(E=0;
  1483. E<J;
  1484. E++){F=I.charCodeAt(E);
  1485. D=(D^F);
  1486. if(D<0){D+=C
  1487. }D=(D*A)%C
  1488. }var B=D.toString(16);
  1489. var H=B.length;
  1490. for(E=H;
  1491. E<8;
  1492. E++){B="0"+B
  1493. }return B
  1494. };
  1495. Klib.hash=function(B,A){A=A||"fnv1a";
  1496. if(A=="fnv1a"){return Klib.fnv1a(B)
  1497. }else{throw Error("Unknown hash function "+A)
  1498. }};
  1499. Klib.GEvent.addEvent("login",Klib.Cache.resetAll);
  1500. Klib.GEvent.addEvent("logout",Klib.Cache.resetAll)
  1501. }if(Klib.install("Ajax",0.1)){Klib.Ajax.cache=new Klib.Cache.Obj("Ajax");
  1502. Klib.Ajax.getJson=function(A,C){var B=new Klib.Ajax.Obj(A);
  1503. B.onComplete=C;
  1504. B.isJson=true;
  1505. B.send()
  1506. };
  1507. Klib.Ajax.get=function(A,C){var B=new Klib.Ajax.Obj(A);
  1508. B.onComplete=C;
  1509. B.send()
  1510. };
  1511. Klib.Ajax.abortAll=function(A){for(var B in Klib.Ajax.currentRequests){try{if(Klib.Ajax.currentRequests[B]){if(!A||(A==Klib.Ajax.currentRequests[B].requestType)){Klib.Ajax.currentRequests[B].abort()
  1512. }}}catch(C){Klib.warning("Failed to abort ajax request",B)
  1513. }}};
  1514. Klib.Ajax.id=0;
  1515. Klib.Ajax.currentRequests={};
  1516. Klib.Ajax.XMLHttpRequest=function(){if(window.XMLHttpRequest){return new XMLHttpRequest()
  1517. }else{if(window.ActiveXObject){try{return new ActiveXObject("Msxml2.XmlHttp")
  1518. }catch(A){}try{return new ActiveXObject("Microsoft.XmlHttp")
  1519. }catch(A){}}}return false
  1520. };
  1521. Klib.Ajax.ERROR_UNKNOWN=900;
  1522. Klib.Ajax.PERMISSION_DENIED=901;
  1523. Klib.Ajax.REQUEST_TIMED_OUT=902;
  1524. Klib.Ajax.STATUS_ABORTED=903;
  1525. Klib.Ajax.STATUS_MAX_LENGTH_EXCEEDED=904;
  1526. Klib.Ajax.ERROR_NON_JSON_RESPONSE=905;
  1527. Klib.Ajax.ERROR_CANNOT_FIND_SERVER=906;
  1528. Klib.Ajax.ERROR_REDIRECT_LIMIT_REACHED=907;
  1529. Klib.Ajax.ERROR_CIRCULAR_REDIRECT=908;
  1530. Klib.Ajax.ERROR_INVALID_URL=909;
  1531. Klib.Ajax.STATE_INITALISED=0;
  1532. Klib.Ajax.STATE_SENDING=1;
  1533. Klib.Ajax.STATE_FINISHED=2;
  1534. Klib.Ajax.STATE_ABORTED=3;
  1535. Klib.Ajax.Obj=function(url,onComplete){var _this=this;
  1536. _this.id=Klib.Ajax.id++;
  1537. _this.requestType="";
  1538. _this.url=url;
  1539. _this.method="GET";
  1540. _this.data=[];
  1541. _this.onHead=null;
  1542. _this.headChecked=false;
  1543. _this.onComplete=onComplete||function(){};
  1544. _this.sync=true;
  1545. _this.isJson=false;
  1546. _this.error=false;
  1547. _this.cached=false;
  1548. _this.useCache=false;
  1549. _this.charset="utf-8";
  1550. _this.checkEncoding=false;
  1551. _this.overrideMimeType="";
  1552. _this.headersChecked=false;
  1553. _this.responseHeader="";
  1554. _this.httpUser="";
  1555. _this.httpPass="";
  1556. _this.timeout=20;
  1557. _this.timerError=null;
  1558. _this.headers={};
  1559. _this.requestHeaders={};
  1560. _this.allowRangeHeader=true;
  1561. _this.status=0;
  1562. _this.statusText="";
  1563. _this.contentLength=0;
  1564. _this.maxContentLength=0;
  1565. _this.state=Klib.Ajax.STATE_INITALISED;
  1566. var xmlhttp=null;
  1567. _this.switchEncoding=function(){if(_this.encodingSwitched||!xmlhttp.overrideMimeType){return false
  1568. }var charset="";
  1569. var matches;
  1570. var charsetReason="";
  1571. var responseText="";
  1572. if((_this.headersChecked)&&_this.headers&&_this.headers.content_type&&Klib.isHTMLHeader(_this.headers)){_this.headersChecked=true;
  1573. matches=_this.headers.content_type.match(/\bcharset\s*=\s*([\w\-]*)/i);
  1574. if(matches){charsetReason="header : "+_this.headers.content_type;
  1575. charset=matches[1].toLowerCase()
  1576. }}if(xmlhttp&&xmlhttp.responseText){responseText=xmlhttp.responseText;
  1577. matches=xmlhttp.responseText.match(/<meta[^>]*\bcontent=["'][^'"]*?charset\s*=\s*([\w\-]+)/i);
  1578. if(matches){charsetReason="meta tag : "+matches[0];
  1579. charset=matches[1].toLowerCase()
  1580. }else{if(!charset){var invalidChar=String.fromCharCode(65533);
  1581. if(xmlhttp.responseText.indexOf(invalidChar)>-1){charsetReason="invalidCharacter : ";
  1582. charset="iso-8859-1"
  1583. }}}}var INVALID_CHAR=String.fromCharCode(65533);
  1584. if(charset&&(_this.charset!=charset)&&responseText&&(responseText.indexOf(INVALID_CHAR)>-1)){_this.charset=charset;
  1585. _this.encodingSwitched=true;
  1586. _this.overrideMimeType="text/html; charset="+charset;
  1587. _this.resend("changing charsets ["+charset+"]");
  1588. return true
  1589. }else{return false
  1590. }};
  1591. _this.onReadyStateChange=function(){if(!window.Klib){xmlhttp.abort();
  1592. xmlhttp=null;
  1593. return 
  1594. }if(_this.state==Klib.Ajax.STATE_SENDING){if(xmlhttp.readyState==4){Klib.clearTimer(_this.timerError);
  1595. try{if(_this.method!="HEAD"&&_this.allowRangeHeader&&_this.requestHeaders.Range&&(xmlhttp.status==400||(xmlhttp.status==200&&!xmlhttp.responseText))){_this.allowRangeHeader=false;
  1596. _this.resend("range header [status="+xmlhttp.status+"]");
  1597. return 
  1598. }if(Klib.isFirefox3&&(xmlhttp.status>=300)&&(xmlhttp.status<400)){if(_this.formatHeaders()&&_this.headers.location){_this.url=_this.headers.location;
  1599. _this.resend("FF3 follow location header [status="+xmlhttp.status+"]");
  1600. return 
  1601. }}if(xmlhttp.status==200||xmlhttp.status===0||xmlhttp.status==206){_this.status=xmlhttp.status||200;
  1602. _this.statusText=xmlhttp.statusText
  1603. }else{if(xmlhttp.status){_this.throwError(xmlhttp.status,xmlhttp.statusText)
  1604. }else{if(_this.state==Klib.Ajax.STATE_ABORTED){}else{_this.throwError(Klib.Ajax.ERROR_UNKNOWN,xmlhttp.statusText)
  1605. }}}}catch(e){if(!_this.error){if(e.result&&e.result==2147746065){_this.throwError(Klib.Ajax.ERROR_CANNOT_FIND_SERVER,Klib.string("ajax.error.cannot.find.server"))
  1606. }else{_this.throwError(Klib.Ajax.ERROR_UNKNOWN,Klib.string("ajax.error.unknown"),e)
  1607. }}}if(_this.status==200||_this.status==206){_this.finish()
  1608. }}else{if(_this.onHead&&!_this.headChecked){var status=0;
  1609. try{status=xmlhttp.status
  1610. }catch(e){}if(status<300||status>=400){if(_this.formatHeaders()){_this.headChecked=true;
  1611. if(!_this.onHead(_this)){_this.finish(true);
  1612. return 
  1613. }else{if(_this.checkEncoding&&_this.switchEncoding()){return 
  1614. }}}}}else{if(_this.maxContentLength){var responseText="";
  1615. try{responseText=xmlhttp.responseText
  1616. }catch(e){}if(_this.checkEncoding&&_this.switchEncoding()){return 
  1617. }else{if(responseText.length>_this.maxContentLength){_this.throwError(Klib.Ajax.STATUS_MAX_LENGTH_EXCEEDED,Klib.string("ajax.error.maximum.length.exceeded"));
  1618. return 
  1619. }}}}}}};
  1620. _this.addData=function(key,value){_this.data.push({key:key,value:value});
  1621. _this.method="POST"
  1622. };
  1623. _this.encodeData=function(){var encoded="";
  1624. for(var i=0;
  1625. i<_this.data.length;
  1626. i++){encoded+="&"+_this.data[i].key+"="+encodeURIComponent(_this.data[i].value)
  1627. }return encoded
  1628. };
  1629. _this.send=function(){xmlhttp=Klib.Ajax.XMLHttpRequest();
  1630. if(Klib.isFirefox3){xmlhttp.mozBackgroundRequest=true
  1631. }var url=_this.url;
  1632. if(_this.onHead&&Klib.isIE){_this.origMethod=_this.method;
  1633. _this.method="HEAD";
  1634. url=_this.url.replace(/#.*$/,"")
  1635. }if(_this.useCache&&(!_this.avoidCache)&&(_this.method=="GET")&&Klib.Ajax.cache.exists(_this.url)){_this.retrieveFromCache();
  1636. _this.onComplete(_this);
  1637. return 
  1638. }try{xmlhttp.open(_this.method,url,_this.sync)
  1639. }catch(e){Klib.error("Ajax","permission denied or invalid Url",_this.method,url);
  1640. if(e.result==2147500037){_this.throwError(Klib.Ajax.ERROR_INVALID_URL,Klib.string("ajax.error.invalid.url"))
  1641. }else{_this.throwError(Klib.Ajax.PERMISSION_DENIED,Klib.string("ajax.error.permission.denied"))
  1642. }return 
  1643. }if(_this.method=="POST"){_this.requestHeaders["Content-Type"]="application/x-www-form-urlencoded; charset=UTF-8"
  1644. }if(_this.httpUser&&_this.httpPass){_this.requestHeaders.Authorization="Basic "+Klib.toBase64(_this.httpUser+":"+_this.httpPass)
  1645. }if(!_this.useCache||_this.avoidCache||_this.method!="GET"){_this.requestHeaders["Cache-control"]="no-cache";
  1646. _this.requestHeaders.Pragma="no-cache"
  1647. }if(_this.maxContentLength&&_this.allowRangeHeader&&_this.method!="HEAD"){_this.requestHeaders.Range="bytes=0-"+_this.maxContentLength
  1648. }else{_this.requestHeaders.Range=null
  1649. }if(_this.overrideMimeType&&xmlhttp.overrideMimeType){xmlhttp.overrideMimeType(_this.overrideMimeType)
  1650. }if(_this.url.toLowerCase().replace(/[\?#].*$/,"").indexOf("interclue.com")>-1){_this.requestHeaders["X-Clue-Plugin"]="firefox"
  1651. }for(var key in _this.requestHeaders){if(_this.requestHeaders[key]){xmlhttp.setRequestHeader(key,_this.requestHeaders[key])
  1652. }}xmlhttp.onreadystatechange=_this.onReadyStateChange;
  1653. if(_this.timeout){_this.timerError=Klib.setTimer(_this.timedOut,(_this.timeout*1000))
  1654. }_this.state=Klib.Ajax.STATE_SENDING;
  1655. Klib.Ajax.currentRequests[_this.id]=_this;
  1656. try{xmlhttp.send(_this.encodeData())
  1657. }catch(e){_this.throwError(Klib.Ajax.ERROR_UNKNOWN,e)
  1658. }};
  1659. _this.resend=function(reason){_this.halt();
  1660. _this.avoidCache=true;
  1661. _this.send()
  1662. };
  1663. _this.abort=function(){if(_this.state==Klib.Ajax.STATE_SENDING){_this.state=Klib.Ajax.STATE_ABORTED;
  1664. _this.throwError(Klib.Ajax.STATUS_ABORTED,Klib.string("ajax.error.aborted"))
  1665. }};
  1666. _this.timedOut=function(evt){if(_this.state==Klib.Ajax.STATE_SENDING){_this.throwError(Klib.Ajax.REQUEST_TIMED_OUT,Klib.string("ajax.error.request.timed.out"))
  1667. }};
  1668. _this.throwError=function(errNo,errText,extra){_this.error=true;
  1669. _this.status=errNo;
  1670. _this.statusText=errText;
  1671. extra=extra||"";
  1672. var msg="ajax:"+_this.id+":error "+errNo+":"+errText;
  1673. _this.finish()
  1674. };
  1675. _this.halt=function(){_this.state=Klib.Ajax.STATE_FINISHED;
  1676. Klib.clearTimer(_this.timerError);
  1677. if(!_this.headers.location){try{if(_this.url!=xmlhttp.channel.URI.spec){_this.responseURI=xmlhttp.channel.URI.spec
  1678. }}catch(e){}}try{xmlhttp.abort();
  1679. delete xmlhttp
  1680. }catch(e){}};
  1681. _this.finish=function(ignoreResponse){if(_this.state!=Klib.Ajax.STATE_FINISHED){_this.state=Klib.Ajax.STATE_FINISHED;
  1682. _this.responseText="";
  1683. try{if(xmlhttp){_this.formatHeaders();
  1684. if(xmlhttp.responseText&&!ignoreResponse){_this.responseText=xmlhttp.responseText;
  1685. if(_this.maxContentLength&&(_this.responseText.length>_this.maxContentLength)){_this.responseText=_this.responseText.substr(0,_this.maxContentLength)
  1686. }}if(xmlhttp.responseXML){_this.responseXML=xmlhttp.responseXML
  1687. }}}catch(e){}if(_this.checkEncoding&&_this.switchEncoding()){return 
  1688. }_this.halt();
  1689. if(Klib.isIE&&_this.onHead&&_this.origMethod&&((!_this.error)||(_this.status==405))){if(_this.onHead(_this)){_this.onHead=null;
  1690. _this.method=_this.origMethod;
  1691. _this.send();
  1692. return 
  1693. }}if(_this.isJson&&!_this.error&&!ignoreResponse){var z=false;
  1694. try{eval("z = "+_this.responseText);
  1695. _this.json=z
  1696. }catch(e){_this.error=true;
  1697. _this.status=Klib.Ajax.ERROR_NON_JSON_RESPONSE;
  1698. _this.statusText=Klib.string("ajax.error.json.decoding.error");
  1699. Klib.error("ajax:"+_this.id+": Json decoding error : ",_this.url,e,_this.responseText)
  1700. }}if(_this.useCache&&(_this.method=="GET")&&(_this.status==200)){_this.addToCache()
  1701. }Klib.Ajax.currentRequests[_this.id]=null;
  1702. _this.onComplete(_this)
  1703. }};
  1704. _this.retrieveFromCache=function(){var cached=Klib.Ajax.cache.get(_this.url);
  1705. if(cached){for(var prop in cached){_this[prop]=cached[prop]
  1706. }}};
  1707. _this.addToCache=function(){var cached={headers:_this.headers,status:_this.status,statusText:_this.statusText,responseText:_this.responseText,error:_this.error,json:_this.json};
  1708. Klib.Ajax.cache.add(_this.url,cached)
  1709. };
  1710. _this.calculateContentLength=function(){var suggestedLength=0;
  1711. var textLength=0;
  1712. var matches;
  1713. if(_this.headers.content_range&&(matches=_this.headers.content_range.match(/\d+\/(\d+)$/))){suggestedLength=parseInt(matches[1])
  1714. }else{if(_this.headers.content_length&&(_this.headers.content_length>2048)&&(_this.headers.content_length!=_this.maxContentLength)){suggestedLength=parseInt(_this.headers.content_length)
  1715. }}if(_this.responseText&&_this.responseText.length!=_this.maxContentLength){textLen=_this.responseText.length
  1716. }if(suggestedLength&&suggestedLength>textLength){return suggestedLength
  1717. }else{if(textLength){return textLength
  1718. }else{return 0
  1719. }}};
  1720. _this.formatHeaders=function(){_this.headers={content_type:"text/html"};
  1721. _this.responseHeader="";
  1722. var header_str="";
  1723. try{header_str=xmlhttp.getAllResponseHeaders();
  1724. _this.responseHeader=header_str
  1725. }catch(e){}if(header_str){var bits=header_str.split("\n");
  1726. for(var i=0;
  1727. i<bits.length;
  1728. i++){var pair=bits[i].match(/^([\w\-]+)\s*:(.*)/);
  1729. if(pair){var key=pair[1].toLowerCase().replace("-","_");
  1730. _this.headers[key]=Klib.format(pair[2])
  1731. }}_this.contentLength=_this.calculateContentLength();
  1732. return(_this.headers=={})?false:_this.headers
  1733. }else{return false
  1734. }}
  1735. };
  1736. Klib.Ajax.getElementValue=function(A){if(A.tagName=="INPUT"){switch(A.type){case"checkbox":return A.checked;
  1737. break;
  1738. default:return A.value
  1739. }}return null
  1740. };
  1741. Klib.Ajax.form=function(B){var C=new Klib.Ajax.Obj();
  1742. C.url=B.action;
  1743. C.method=B.method;
  1744. for(var A=0;
  1745. A<B.elements.length;
  1746. A++){C.addData(B.elements[A].name,Klib.Ajax.getElementValue(B.elements[A]))
  1747. }return C
  1748. };
  1749. Klib.toBase64=function(D){var B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  1750. var A="";
  1751. var K,I,G;
  1752. var J,H,F,E;
  1753. var C=0;
  1754. while(C<D.length){K=D.charCodeAt(C++);
  1755. I=D.charCodeAt(C++);
  1756. G=D.charCodeAt(C++);
  1757. J=K>>2;
  1758. H=((K&3)<<4)|(I>>4);
  1759. F=((I&15)<<2)|(G>>6);
  1760. E=G&63;
  1761. if(isNaN(I)){F=E=64
  1762. }else{if(isNaN(G)){E=64
  1763. }}A=A+B.charAt(J)+B.charAt(H)+B.charAt(F)+B.charAt(E)
  1764. }return A
  1765. }
  1766. }if(Klib.install("Key",0.1)){Klib.Key.events=[];
  1767. Klib.Key.lastKeyId="";
  1768. Klib.Key.CODE_SHIFT=16;
  1769. Klib.Key.CODE_CTRL=17;
  1770. Klib.Key.CODE_ALT=18;
  1771. Klib.Key.CODE_LEFT_ARROW=37;
  1772. Klib.Key.CODE_UP_ARROW=38;
  1773. Klib.Key.CODE_RIGHT_ARROW=39;
  1774. Klib.Key.CODE_DOWN_ARROW=40;
  1775. Klib.Key.getEventKeys=function(A){var B=[];
  1776. if(A.ctrlKey){B.push(Klib.Key.CODE_CTRL)
  1777. }if(A.shiftKey){B.push(Klib.Key.CODE_SHIFT)
  1778. }if(A.altKey){B.push(Klib.Key.CODE_ALT)
  1779. }if(A.keyCode&&!Klib.inArray(A.keyCode,B)){B.push(A.keyCode)
  1780. }B.sort(function(D,C){return D-C
  1781. });
  1782. return B
  1783. };
  1784. Klib.Key.addEvent=function(D,C){var E=Klib.Key.generateId(D);
  1785. Klib.Key.events[E]=Klib.Key.events[E]||[];
  1786. for(var A=0;
  1787. A<Klib.Key.events[E].length;
  1788. A++){var B=Klib.Key.events[E][A];
  1789. if(B==C){return 
  1790. }}Klib.Key.events[E].push(C)
  1791. };
  1792. Klib.Key.generateId=function(A){return Klib.safeSort(A,"number").join("-")
  1793. };
  1794. Klib.Key.removeEvent=function(B,A){var C=Klib.Key.generateId(B);
  1795. Klib.Key.events[C]=Klib.Key.events[C]||[];
  1796. Klib.Key.events[C]=Klib.arrayRemove(Klib.Key.events[C],A)
  1797. };
  1798. Klib.Key.handleKeyDown=function(A){var D=Klib.Key.getEventKeys(A);
  1799. var E=Klib.Key.generateId(D);
  1800. if(Klib.Key.lastKeyId!=E){Klib.Key.lastKeyId=E;
  1801. if(Klib.Key.events[E]){for(var B=0;
  1802. B<Klib.Key.events[E].length;
  1803. B++){var C=Klib.Key.events[E][B];
  1804. C(A)
  1805. }}}};
  1806. Klib.Key.handleKeyUp=function(A){Klib.Key.lastKeyId=""
  1807. };
  1808. Klib.Key.initDoc=function(A){Klib.addEvent(A,"keydown",Klib.Key.handleKeyDown);
  1809. Klib.addEvent(A,"keyup",Klib.Key.handleKeyUp)
  1810. };
  1811. Klib.Key.cleanUpDoc=function(A){Klib.removeEvent(A,"keydown",Klib.Key.handleKeyDown);
  1812. Klib.removeEvent(A,"keyup",Klib.Key.handleKeyUp)
  1813. }
  1814. }if(Klib.install("Mouse",0.1)){Klib.Mouse.screenX=0;
  1815. Klib.Mouse.screenY=0;
  1816. Klib.Mouse.button=0;
  1817. Klib.Mouse.lastEvent=null;
  1818. Klib.Mouse.handleMouseMove=function(A){Klib.Mouse.screenX=A.screenX;
  1819. Klib.Mouse.screenY=A.screenY;
  1820. Klib.Mouse.docX=A.docX;
  1821. Klib.Mouse.docY=A.docY;
  1822. Klib.Mouse.lastEvent=Klib.cloneIEMouseEvent(A);
  1823. Klib.Mouse.currNode=A.currTarget;
  1824. var B=Klib.getDoc(A.currTarget);
  1825. if(B){Klib.Mouse.doc=B;
  1826. B.screenX=Klib.Mouse.screenX-Klib.Mouse.docX;
  1827. B.screenY=Klib.Mouse.screenY-Klib.Mouse.docY
  1828. }};
  1829. Klib.Mouse.handleMouseUp=function(A){Klib.Mouse.button=0;
  1830. Klib.Mouse.lastEvent=A
  1831. };
  1832. Klib.Mouse.handleMouseDown=function(A){Klib.Mouse.button=A.mouseButton;
  1833. Klib.Mouse.lastEvent=A
  1834. };
  1835. Klib.Mouse.initDoc=function(B){var A=Klib.getWin(B,true);
  1836. Klib.addEvent(B,"mousemove",Klib.Mouse.handleMouseMove);
  1837. Klib.addEvent(B,"mouseup",Klib.Mouse.handleMouseUp);
  1838. Klib.addEvent(B,"mousedown",Klib.Mouse.handleMouseDown);
  1839. Klib.addEvent(A,"mousewheel",Klib.Mouse.handleMouseMove);
  1840. Klib.addEvent(A,"mouseout",Klib.Mouse.handleMouseOut)
  1841. };
  1842. Klib.Mouse.handleMouseOut=function(A){if(!A.relatedTarget&&!A.toElement){Klib.Mouse.currNode=null
  1843. }};
  1844. Klib.Mouse.cleanUpDoc=function(B){var A=Klib.getWin(B,true);
  1845. var C=Klib.getDocs(A,true);
  1846. Klib.removeEvent(A,"mouseout",Klib.Mouse.handleMouseOut);
  1847. Klib.removeEvent(C,"mousemove",Klib.Mouse.handleMouseMove);
  1848. Klib.removeEvent(C,"mouseup",Klib.Mouse.handleMouseUp);
  1849. Klib.removeEvent(C,"mousedown",Klib.Mouse.handleMouseDown)
  1850. }
  1851. }if(Klib.install("Hover",0.1)){Klib.Hover.addHover=function(C,A,B){Klib.Hover.initDoc(C.ownerDocument);
  1852. Klib.Hover.initEle(C);
  1853. C.hover.handlers.push({timeout:B,func:A});
  1854. Klib.Hover.registerTimer(C.ownerDocument,B)
  1855. };
  1856. Klib.Hover.initEle=function(A){A.hover=A.hover||{};
  1857. A.hover.handlers=A.hover.handlers||[]
  1858. };
  1859. Klib.Hover.registerTimer=function(B,A){if(!B.hover.timerFunctions[A]){B.hover.timerFunctions[A]=function(){Klib.Hover.fireHoverEvent(B,A)
  1860. }
  1861. }};
  1862. Klib.Hover.fireHoverEvent=function(G,E){try{G.URL;
  1863. G.hover.lastMouseEvent.currTarget
  1864. }catch(F){return 
  1865. }if(Klib.Drag.dragging){return 
  1866. }var D=G.hover.lastMouseEvent.currTarget;
  1867. while(D){if(D&&D.hover&&D.hover.handlers){for(var B=0;
  1868. B<D.hover.handlers.length;
  1869. B++){var C=D.hover.handlers[B];
  1870. if(C.timeout==E){var A=G.hover.lastMouseEvent;
  1871. A.source=D;
  1872. C.func(A)
  1873. }}}D=D.parentNode
  1874. }};
  1875. Klib.Hover.restartTimers=function(B){if(B.hover&&B.hover.timerFunctions){for(var A in B.hover.timerFunctions){if(B.hover.timers[A]){window.clearTimeout(B.hover.timers[A])
  1876. }B.hover.timers[A]=window.setTimeout(B.hover.timerFunctions[A],A)
  1877. }}};
  1878. Klib.Hover.stopTimers=function(B){if(B.hover&&B.hover.timers){for(var A in B.hover.timers){if(B.hover.timers[A]){window.clearTimeout(B.hover.timers[A])
  1879. }}}};
  1880. Klib.Hover.handleMouseMove=function(A){var B=A.source;
  1881. if(B.hover){B.hover.lastMouseEvent=Klib.isIE?Klib.cloneIEMouseEvent(A):A;
  1882. Klib.Hover.restartTimers(B)
  1883. }};
  1884. Klib.Hover.initDoc=function(A){A.hover=A.hover||{};
  1885. A.hover.timers=A.hover.timers||{};
  1886. A.hover.timerFunctions=A.hover.timerFunctions||{};
  1887. if(!A.hover.mousemoveAttached){Klib.addEvent(A,"mousemove",Klib.Hover.handleMouseMove)
  1888. }};
  1889. Klib.Hover.cleanupDoc=function(A){Klib.removeEvent(A,"mousemove",Klib.Hover.handleMouseMove);
  1890. Klib.Hover.stopTimers(A);
  1891. A.hover=null
  1892. }
  1893. }if(Klib.install("XPath",0.1)){Klib.XPath.eval=function(J,B){var M=[];
  1894. B=B.replace(/^\/html\/body\//,"");
  1895. var G=J.body;
  1896. var K=B.toLowerCase().split(/\//g);
  1897. for(var F=0;
  1898. F<K.length;
  1899. F++){var L=false;
  1900. var H=K[F].match(/(\w+)(\[(\d+)\])?/);
  1901. if(H){var E=H[1];
  1902. var I=H[3]||1;
  1903. var D=0;
  1904. for(var C=0;
  1905. C<G.childNodes.length;
  1906. C++){var A=G.childNodes[C];
  1907. if(A.nodeName.toLowerCase()==E){D++;
  1908. if(D==I){G=A;
  1909. L=true;
  1910. break
  1911. }}}}if(!L){return false
  1912. }}return G
  1913. }
  1914. }if(Klib.install("Drag",0.1,"Mouse")){Klib.Drag.MIN_START_DRAG_DISTANCE=1;
  1915. Klib.Drag.isOverWindow=true;
  1916. Klib.Drag.initEle=function(C,B){if(!B){var A=Klib.getEles(".draghandle",C);
  1917. B=(A.length)?A[0]:C
  1918. }B.dragEle=C;
  1919. C.dragDir="both";
  1920. Klib.addEvent(B,"mousedown",Klib.Drag.start)
  1921. };
  1922. Klib.Drag.initWin=function(A){var B=Klib.getWin(A);
  1923. A.dragWin=B;
  1924. Klib.addEvent(A,"mousedown",Klib.Drag.start)
  1925. };
  1926. Klib.Drag.preventSelection=function(A){A.halt();
  1927. return false
  1928. };
  1929. Klib.Drag.endDragIfNotOverWindow=function(){if(!Klib.Drag.isOverWindow){Klib.Drag.finish()
  1930. }};
  1931. Klib.Drag.overWindow=function(){Klib.Drag.isOverWindow=true;
  1932. if(Klib.Drag.dragging){Klib.clearTimer("KlibDragEndDragIfNotOverWindow")
  1933. }};
  1934. Klib.Drag.leaveWindow=function(){Klib.Drag.isOverWindow=false;
  1935. if(Klib.Drag.dragging){Klib.setNamedTimer("KlibDragEndDragIfNotOverWindow",Klib.Drag.endDragIfNotOverWindow,700)
  1936. }};
  1937. Klib.Drag.finish=function(A){Klib.Drag.end(A,true)
  1938. };
  1939. Klib.Drag.start=function(A){Klib.Drag.end();
  1940. Klib.Drag.isOverWindow=true;
  1941. if(A.mouseButton==1){Klib.Drag.starting=true;
  1942. Klib.Drag.viewportRect=Klib.Drag.getViewportScreenRect();
  1943. Klib.Drag.dragHandle=A.source;
  1944. Klib.Drag.dragEle=A.source.dragEle;
  1945. Klib.Drag.dragWin=A.source.dragWin;
  1946. var B=Klib.getWin(Klib.Drag.dragHandle,true);
  1947. var C=Klib.getDocs(B,true);
  1948. Klib.addEvent(C,"mouseup",Klib.Drag.finish);
  1949. Klib.addEvent(C,"mousemove",Klib.Drag.overWindow);
  1950. Klib.addEvent(B,"mouseout",Klib.Drag.leaveWindow);
  1951. Klib.addEvent(C,"drag",Klib.Drag.preventSelection);
  1952. Klib.addEvent(C,"mousemove",Klib.Drag.doDrag);
  1953. Klib.Drag.startScreenX=A.screenX;
  1954. Klib.Drag.startScreenY=A.screenY;
  1955. A.halt()
  1956. }};
  1957. Klib.Drag.convertPositionToAbsolute=function(A){if((A.style.position!="absolute")&&(A.style.position!="fixed")){Klib.setStyle(A,"top",A.offsetTop+"px");
  1958. Klib.setStyle(A,"left",A.offsetLeft+"px");
  1959. Klib.setStyle(A,"position","absolute")
  1960. }};
  1961. Klib.Drag.getViewportScreenRect=function(){if(Klib.platform=="firefox"){var A=top.gBrowser.selectedBrowser;
  1962. return Klib.rect(A.boxObject.screenX,A.boxObject.screenY,A.boxObject.width,A.boxObject.height)
  1963. }return null
  1964. };
  1965. Klib.Drag.doDrag=function(H){if(Klib.Drag.starting){if((Klib.Drag.startScreenX!=H.screenX)||(Klib.Drag.startScreenY!=H.screenY)){Klib.Drag.starting=false;
  1966. Klib.Drag.dragging=true;
  1967. Klib.fireEvent(Klib.Drag.dragEle,"dragbegin",H);
  1968. if(Klib.Drag.dragEle&&!Klib.Drag.dragEle.dragDontMove){if((Klib.Drag.dragEle.tagName!="IFRAME")&&Klib.Pref.get("Drag.transparency")){Klib.setStyle(Klib.Drag.dragEle,"opacity",0.5)
  1969. }Klib.Drag.convertPositionToAbsolute(Klib.Drag.dragEle);
  1970. var C=Klib.getRect(Klib.Drag.dragEle);
  1971. Klib.Drag.startOffsetX=H.docX-C.left;
  1972. Klib.Drag.startOffsetY=H.docY-C.top;
  1973. Klib.Drag.startEleX=Klib.Drag.dragEle.offsetLeft;
  1974. Klib.Drag.startEleY=Klib.Drag.dragEle.offsetTop
  1975. }else{if(Klib.Drag.dragWin){var G=Klib.getRect(Klib.Drag.dragWin);
  1976. Klib.Drag.startWinX=G.left;
  1977. Klib.Drag.startWinY=G.top;
  1978. Klib.Drag.startOffsetX=Klib.Drag.startScreenX-Klib.Drag.startWinX;
  1979. Klib.Drag.startOffsetY=Klib.Drag.startScreenY-Klib.Drag.startWinY
  1980. }}}}if(Klib.Drag.dragging&&Klib.isIE&&(H.mouseButton!=1)){Klib.Drag.finish(H)
  1981. }else{if(Klib.Drag.dragging&&!Klib.Drag.moving){if(Klib.Drag.viewportRect&&Klib.pointInRect({x:H.screenX,y:H.screenY},Klib.Drag.viewportRect)){Klib.Drag.moving=true;
  1982. H.halt();
  1983. try{Klib.getWin(Klib.Drag.dragHandle).focus()
  1984. }catch(F){}var A;
  1985. var J;
  1986. if(Klib.Drag.dragEle){if(Klib.Drag.dragEle.dragDontMove){Klib.fireEvent(Klib.Drag.dragEle,"dragging",H)
  1987. }else{var E=parseInt(H.screenX-Klib.Drag.startScreenX);
  1988. var D=parseInt(H.screenY-Klib.Drag.startScreenY);
  1989. A=(Klib.Drag.startEleX+E);
  1990. J=(Klib.Drag.startEleY+D);
  1991. if(Klib.Drag.dragEle.dragLimit){var B=(Klib.Drag.dragEle.dragLimit.bottom)?Klib.Drag.dragEle.dragLimit:Klib.getRect(Klib.Drag.dragEle.dragLimit);
  1992. var I=Klib.getRect(Klib.Drag.dragEle);
  1993. A=Klib.limit(A,B.left,(B.right-I.width));
  1994. J=Klib.limit(J,B.top,(B.bottom-I.height))
  1995. }switch(Klib.Drag.dragEle.dragDir){case"horizontal":Klib.setStyle(Klib.Drag.dragEle,"left",A+"px");
  1996. break;
  1997. case"vertical":Klib.setStyle(Klib.Drag.dragEle,"top",J+"px");
  1998. break;
  1999. case"both":default:Klib.setStyle(Klib.Drag.dragEle,"left",A+"px");
  2000. Klib.setStyle(Klib.Drag.dragEle,"top",J+"px");
  2001. break
  2002. }Klib.fireEvent(Klib.Drag.dragEle,"dragging",H)
  2003. }}else{if(Klib.Drag.dragWin){var A=(H.screenX-Klib.Drag.startOffsetX);
  2004. var J=(H.screenY-Klib.Drag.startOffsetY);
  2005. Klib.Drag.dragWin.moveTo(A,J)
  2006. }}Klib.Drag.moving=false
  2007. }}}};
  2008. Klib.Drag.reset=function(){Klib.Drag.startScreenX=0;
  2009. Klib.Drag.startScreenY=0;
  2010. Klib.Drag.startOffsetX=0;
  2011. Klib.Drag.startOffsetY=0;
  2012. Klib.Drag.startEleX=0;
  2013. Klib.Drag.startEleY=0;
  2014. Klib.Drag.startWinX=0;
  2015. Klib.Drag.startWinY=0;
  2016. Klib.Drag.dragDoc=null;
  2017. Klib.Drag.dragEle=null;
  2018. Klib.Drag.dragWin=null;
  2019. Klib.Drag.dragHandle=null;
  2020. Klib.Drag.starting=false;
  2021. Klib.Drag.dragging=false;
  2022. Klib.Drag.moving=false
  2023. };
  2024. Klib.Drag.cleanupDoc=function(B){var A=Klib.getWin(B);
  2025. var C=Klib.getDocs(A,true);
  2026. Klib.removeEvent(C,"selectstart",Klib.Drag.preventSelection);
  2027. Klib.removeEvent(C,"drag",Klib.Drag.preventSelection);
  2028. Klib.removeEvent(C,"mousemove",Klib.Drag.doDrag);
  2029. Klib.removeEvent(C,"mouseup",Klib.Drag.finish);
  2030. Klib.removeEvent(C,"mousemove",Klib.Drag.overWindow);
  2031. Klib.removeEvent(A,"mouseout",Klib.Drag.leaveWindow)
  2032. };
  2033. Klib.Drag.end=function(A,B){if(Klib.Drag.dragging&&Klib.Drag.dragHandle&&Klib.Drag.dragEle&&B){Klib.fireEvent(Klib.Drag.dragEle,"dragfinish",A)
  2034. }if(Klib.Drag.dragHandle){var C=Klib.getWin(Klib.Drag.dragHandle);
  2035. var D=Klib.getDocs(C,true);
  2036. Klib.removeEvent(D,"selectstart",Klib.Drag.preventSelection);
  2037. Klib.removeEvent(D,"drag",Klib.Drag.preventSelection);
  2038. Klib.removeEvent(D,"mousemove",Klib.Drag.doDrag);
  2039. Klib.removeEvent(D,"mouseup",Klib.Drag.finish);
  2040. Klib.removeEvent(D,"mousemove",Klib.Drag.overWindow);
  2041. Klib.removeEvent(C,"mouseout",Klib.Drag.leaveWindow)
  2042. }if(Klib.Drag.dragEle){Klib.restoreStyle(Klib.Drag.dragEle,"opacity")
  2043. }Klib.Drag.reset()
  2044. };
  2045. Klib.Drag.reset()
  2046. }if(Klib.install("Fade",0.1)){Klib.Fade.STATE_NORMAL=0;
  2047. Klib.Fade.STATE_FADING_IN=1;
  2048. Klib.Fade.STATE_FADING_OUT=2;
  2049. Klib.Fade.initEle=function(B,A){B.fade=B.fade||{};
  2050. B.fade.steps=B.getAttribute("fadesteps")||9;
  2051. B.fade.speed=B.getAttribute("fadespeed")||1;
  2052. B.fade.state=B.fade.state||Klib.Fade.STATE_NORMAL;
  2053. B.fade.previousState=A?Klib.Fade.STATE_FADING_IN:Klib.Fade.STATE_FADING_OUT
  2054. };
  2055. Klib.Fade.isEleFading=function(A){return(A&&A.fade&&A.fade.state!=Klib.Fade.STATE_NORMAL)
  2056. };
  2057. Klib.Fade.fadeInEnd=function(A){A.fade.state=Klib.Fade.STATE_NORMAL;
  2058. Klib.setStyle(A,"opacity",0.99);
  2059. Klib.setStyle(A,"visibility","visible");
  2060. Klib.fireEvent(A,"fadein")
  2061. };
  2062. Klib.Fade.fadeOutEnd=function(A){A.fade.state=Klib.Fade.STATE_NORMAL;
  2063. Klib.setStyle(A,"opacity",0);
  2064. Klib.setStyle(A,"visibility","hidden");
  2065. Klib.fireEvent(A,"fadeout")
  2066. };
  2067. Klib.Fade.doFade=function(B){if(B&&B.fade){var A=(1/B.fade.steps);
  2068. if(A<=0){A=0.05
  2069. }var C=Klib.getOpacity(B);
  2070. B.fade.state=B.fade.state||B.fade.previousState;
  2071. if(B.fade.state==Klib.Fade.STATE_FADING_IN){C+=A
  2072. }else{if(B.fade.state==Klib.Fade.STATE_FADING_OUT){C-=A
  2073. }else{Klib.error("Incorrect fade state",B.fade,B);
  2074. return 
  2075. }}if(C>=0.99){Klib.Fade.fadeInEnd(B)
  2076. }else{if(C<=0){Klib.Fade.fadeOutEnd(B)
  2077. }else{Klib.setStyle(B,"opacity",C);
  2078. Klib.setTimer(function(){Klib.Fade.doFade(B)
  2079. },B.fade.speed)
  2080. }}}};
  2081. Klib.Fade.fadeIn=function(C,B,A){Klib.Fade.initEle(C,true);
  2082. C.fade.steps=(A)?A:C.fade.steps;
  2083. C.fade.speed=(B)?parseInt(B/C.fade.steps):C.fade.speed;
  2084. switch(C.fade.state){case Klib.Fade.STATE_NORMAL:if((Klib.getOpacity(C)>=0.99)&&(C.style.visibility=="visible")){return 
  2085. }else{Klib.setStyle(C,"opacity",0);
  2086. Klib.setStyle(C,"visibility","visible")
  2087. }break;
  2088. case Klib.Fade.STATE_FADING_IN:break;
  2089. case Klib.Fade.STATE_FADING_OUT:C.fade.state=Klib.Fade.STATE_FADING_IN;
  2090. return ;
  2091. default:throw Error("Interclue: Invalid fade state: "+C.fade.state)
  2092. }C.fade.state=Klib.Fade.STATE_FADING_IN;
  2093. Klib.Fade.doFade(C)
  2094. };
  2095. Klib.Fade.fadeOut=function(C,B,A){Klib.Fade.initEle(C,false);
  2096. C.fade.steps=(A)?A:C.fade.steps;
  2097. C.fade.speed=(B)?parseInt(B/C.fade.steps):C.fade.speed;
  2098. switch(C.fade.state){case Klib.Fade.STATE_NORMAL:if((Klib.getOpacity(C)==0)||(C.style.visibility=="hidden")){return 
  2099. }else{Klib.setStyle(C,"opacity",0.99);
  2100. Klib.setStyle(C,"visibility","visible")
  2101. }break;
  2102. case Klib.Fade.STATE_FADING_IN:C.fade.state=Klib.Fade.STATE_FADING_OUT;
  2103. return ;
  2104. case Klib.Fade.STATE_FADING_OUT:break;
  2105. default:throw Error("Interclue: Invalid fade state: "+C.fade.state)
  2106. }C.fade.state=Klib.Fade.STATE_FADING_OUT;
  2107. Klib.Fade.doFade(C)
  2108. };
  2109. Klib.getOpacity=function(A){if(A.style.opacity!==undefined){if(A.style.opacity==""){A.style.opacity=(A.style.visibility=="hidden")?0:0.99
  2110. }return parseFloat(A.style.opacity)
  2111. }else{try{return parseFloat(A.filters.alpha.opacity/100)
  2112. }catch(B){return false
  2113. }}}
  2114. }if(Klib.install("Feed",0.1)){Klib.Feed.isFeedContentType=function(B){var A=["text/xml","application/rss+xml","application/atom+xml","application/x.atom+xml","application/x-atom+xml"];
  2115. return Klib.inArray(A,B)
  2116. }
  2117. }if(Klib.install("Url",0.2)){Klib.Url.cache=new Klib.Cache.Obj("Url");
  2118. Klib.Url.cacheParsedUrls=new Klib.Cache.Obj("ParsedUrls",256);
  2119. Klib.Url.alternateSource=function(B){var A={};
  2120. A.facebook=function(F){var E=F.match(/^http:\/\/(www\.)?facebook\.com\/((application|friends|group|note|people|photo|profile|s)\b.*)$/i);
  2121. return(E)?("http://m.facebook.com/"+E[2]):F
  2122. };
  2123. for(var D in A){var C=A[D](B);
  2124. if(C&&(C!=B)&&Klib.Url.isUrl(C)){return C
  2125. }}return B
  2126. };
  2127. Klib.Url.removeRedirect=function(A){var D={google:function(F){var E=F.match(/^http:\/\/[^\/]*\bgoogle.[^\/]*\/url\?(.*)&url=([^&]+)/i);
  2128. return(E)?Klib.decodeURI(E[2]):F
  2129. },googleMaliciousLink:function(F){var E=F.match(/^http:\/\/[^\/]*\bgoogle.[^\/]*\/interstitial\?url=([^&]+)/i);
  2130. return(E)?Klib.decodeURI(E[1]):F
  2131. },googleVideo:function(F){var E=F.match(/^http:\/\/video.google.[^\/]*\/.*[\&]vidurl=([^&]+)/i);
  2132. return(E)?Klib.decodeURI(E[1]):F
  2133. },fark:function(F){var E=F.match(/^http:\/\/go\.fark\.com.\/cgi\/fark\/go.pl\?(.*)?&l=([^&]+)/i);
  2134. return(E)?Klib.decodeURI(E[2]):F
  2135. },"duplicate protocol":function(F){var E=F.match(/^http(s)?:\/\/(http(s)?(:)?\/\/.*)$/i);
  2136. if(E&&E[4]){return E[2]
  2137. }else{if(E){return E[2].replace(/^(\w+)/,"$1:")
  2138. }else{return F
  2139. }}},"missing protocol":function(F){var E=F.match(/^http(s)?:\/\/[^\/]+\/(\w+(\.\w+)+(\.\w{2,6})(\/.*)?)$/i);
  2140. return(E)?("http://"+E[2]):F
  2141. }};
  2142. for(var C in D){var B=D[C](A);
  2143. if(B&&(B!=A)&&Klib.Url.isUrl(B)){return B
  2144. }}return A
  2145. };
  2146. Klib.Url.isPayPerClickUrl=function(C){var B={google:function(E){return/\bgoogle\.[^\/]\/aclk\?/i.test(E.url)
  2147. },doubleclick:function(E){return(E.basedoman=="doubleclick.net")
  2148. }};
  2149. var A=Klib.Url.parse(C);
  2150. if(A.success){for(var D in B){if(B[D](A)){return true
  2151. }}}return false
  2152. };
  2153. Klib.Url.isUrl=function(A){return Klib.Url.parse(A).success
  2154. };
  2155. Klib.Url.add=function(A,B,C,D){D=D||"&";
  2156. A+=(A.indexOf("?")>-1)?D:"?";
  2157. A+=(encodeURIComponent(B)+"="+encodeURIComponent(C));
  2158. return A
  2159. };
  2160. Klib.Url.noHash=function(A){return A.replace(/#.*$/,"")
  2161. };
  2162. Klib.Url.fileToUrl=function(A){return"file:///"+encodeURI(A.replace(/\\/g,"/"))
  2163. };
  2164. Klib.Url.filename=function(B){var A=Klib.Url.parse(B);
  2165. return A.filename
  2166. };
  2167. Klib.Url.domain=function(C,B){var A=Klib.Url.parse(C);
  2168. return(B)?A.basedomain:A.domain
  2169. };
  2170. Klib.Url.noCache=function(B){B=Klib.Url.add(B,"rnd",Klib.timestamp(true)*1000);
  2171. if(Klib.isIE){var A=Klib.Url.filename(B);
  2172. B=Klib.Url.add(B,"filename",A)
  2173. }return B
  2174. };
  2175. Klib.Url.isLocal=function(B){var A=Klib.Url.parse(B);
  2176. if(A.protocol=="file:"){return true
  2177. }else{if(A.isIPAddress){return(A.domain=="127.0.0.1")
  2178. }else{return false
  2179. }}};
  2180. Klib.Url.clean=function(C,A){var B=Klib.Url.parse(C);
  2181. var D=B.protocol+"//"+((A)?B.domain:B.basedomain);
  2182. D+=(B.path?B.path:"/")+B.filename;
  2183. return D
  2184. };
  2185. Klib.Url.toLink=function(B,C,A){C=C||B;
  2186. A=A||50;
  2187. if(C.length>A){var D=Klib.Url.parse(B);
  2188. C=D.domain+"/";
  2189. C+=((D.path!="/")?".../":"");
  2190. C+=(D.filename?D.filename:D.path.replace(/^(.*)\/([^\/]*[\/])$/,"$2"));
  2191. C+=(D.query?"?...":"");
  2192. C+=(D.hash?("#"+D.hash):"")
  2193. }C=Klib.decodeURI(C);
  2194. C=Klib.strTruncate(C,A);
  2195. return'<a href="'+Klib.htmlspecialchars(B)+'" title="'+Klib.htmlspecialchars(Klib.decodeURI(B))+'">'+Klib.htmlspecialchars(C)+"</a>"
  2196. };
  2197. Klib.Url.parse=function(K,B){if(!K){return(B)?null:{success:false}
  2198. }if(K.isParsedUrl){return K
  2199. }var J=Klib.Url.cache.get(K);
  2200. if(!J){var E=K;
  2201. E=E.toString();
  2202. J={success:false,url:"",protocol:"",path:"",query:"",port:"",domain:"",basedomain:"",username:"",password:"",extension:"",filename:"",tld:"",isParsedUrl:true,page:"",canonicalUrl:""};
  2203. J.url=E;
  2204. J.href=E;
  2205. J.page=E.replace(/#.*$/,"");
  2206. if(E){var H=E.match(/\#(.*)/);
  2207. J.anchor=(H)?H[1]:"";
  2208. E=E.replace(/\#(.*)/,"");
  2209. var F=E.match(/\?(.*)/);
  2210. J.query=(F)?F[1]:"";
  2211. E=E.replace(/\?(.*)/,"");
  2212. var C=E.match(/^(\w+:)([^\/]+).*$/);
  2213. if(C){J.protocol=C[1].toLowerCase();
  2214. J.domain=C[2].toLowerCase();
  2215. J.basedomain=J.domain
  2216. }else{var O=E.match(/^(\w+:)\/\/([^\/]*)(\/.*)?/);
  2217. if(O){J.protocol=O[1].toLowerCase();
  2218. var Q=O[2];
  2219. if(Q){var I=Q.match(/:(\d*)$/);
  2220. J.port=(I)?I[1]:"";
  2221. Q=Q.replace(/:(\d*)$/,"");
  2222. var S=Q.match(/[^@]+$/);
  2223. J.domain=(S)?S[0].toLowerCase():"";
  2224. Q=Q.replace(/@?[^@]+$/,"");
  2225. var A=Q.match(/[^:]+$/);
  2226. J.password=(A)?A[0]:"";
  2227. Q=Q.replace(/[^:]+$/,"");
  2228. var D=Q.match(/^[^:]+/);
  2229. J.username=(D)?D[0]:"";
  2230. Q=Q.replace(/^[^:]+/,"");
  2231. if(J.domain){if(J.domain.match(/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/)){J.basedomain=J.domain;
  2232. J.isIPAddress=true
  2233. }else{J.isIPAddress=false;
  2234. var M=J.domain.match(/[^\.]+(\.(ac|aero|biz|com|coop|info|museum|name|net|org|pro|gov|edu|mil|int|co|govt))?(\.(arpa|nato|\w{2}))?$/i);
  2235. J.basedomain=(M)?M[0]:"";
  2236. var P=J.domain.match(/(\.(aero|biz|com|coop|es|info|museum|name|net|org|pro|gov|edu|mil|int|co|govt))(\.(arpa|nato|\w{2}))?$/i);
  2237. J.tld=(P)?P[0]:""
  2238. }}}var L=O[3];
  2239. if(L&&L.indexOf("/")>-1){var G=L.match(/\.(\w+)$/);
  2240. J.extension=(G)?G[1].toLowerCase():"";
  2241. var N=L.match(/[^\/]+$/);
  2242. J.filename=(N)?N[0]:"";
  2243. J.path=L.replace(/[^\/]+$/,"")
  2244. }else{J.path="/"
  2245. }}}}J.success=true;
  2246. for(var R in J){if(typeof J[R]=="string"){J[R]=J[R].replace(/^\s+|\s+$/g,"")
  2247. }}if(J.protocol=="http:"||J.protocol=="https:"){var S=((J.domain==J.basedomain)&&!J.domain.match(/^www/))?("www."+J.domain):J.domain;
  2248. J.canonicalUrl=J.protocol+"//"+S+J.path+J.filename+(J.query?("?"+J.query):"")
  2249. }else{J.canonicalUrl=K
  2250. }Klib.Url.cache.add(K,J)
  2251. }if(B){return J[B]
  2252. }else{return J
  2253. }};
  2254. Klib.Url.realPath=function(C,D){C=C.replace(/\\/g,"/");
  2255. if(D&&!C.match(/^\w+:/)){var E=Klib.Url.parse(Klib.Url.realPath(D));
  2256. if(C.substr(0,1)=="/"){C=E.protocol+"//"+E.domain+"/"+C.substr(1)
  2257. }else{if(C.substr(0,2)=="./"){C=E.protocol+"//"+E.domain+E.path+C.substr(2)
  2258. }else{C=E.protocol+"//"+E.domain+E.path+C
  2259. }}}var B=Klib.Url.parse(C);
  2260. var F=B.path;
  2261. while(1){var A=F.match(/([^\/]+)(\/..\/)/);
  2262. if(A){F=F.replace(A[0],"")
  2263. }else{break
  2264. }}while(F.substr(0,4)=="/../"){F=F.substr(3)
  2265. }return B.protocol+"//"+B.domain+F+B.filename
  2266. };
  2267. Klib.Url.getSiteFromUrl=function(B){var A=Klib.Url.parse(B);
  2268. if(A){if(Klib.Tutorial.isTutorialUrl(A.url)){return"chrome://interclue/content/cluecore/tutorial/"
  2269. }return A.basedomain?A.basedomain:null
  2270. }return null
  2271. };
  2272. Klib.Url.canonicalUrl=function(B){var A=Klib.Url.parse(B);
  2273. if(A&&(A.protocol=="http:"||A.protocol=="https:")){var C=(A.domain==A.basedomain)?"www.":"";
  2274. return A.protocol+"//"+C+A.domain+(A.port?(":"+A.port):"")+A.path+A.filename+(A.query?("?"+A.query):"")
  2275. }else{return null
  2276. }};
  2277. Klib.getUrl=function(C){if(!Klib.Url.cacheParsedUrls.exists(C)){var B=Klib.Url.removeRedirect(C);
  2278. var E=(C!=B);
  2279. B=Klib.Url.alternateSource(B);
  2280. var A=Klib.Url.parse(B);
  2281. A.origURL=C;
  2282. A.isRedirect=E;
  2283. Klib.Url.cacheParsedUrls.add(C,A)
  2284. }var D=Klib.clone(Klib.Url.cacheParsedUrls.get(C));
  2285. return D
  2286. };
  2287. Klib.getUrlFromLink=function(B){var A=B.href;
  2288. if(B.getAttribute("href")=="#"){A="javascript:;"
  2289. }return Klib.getUrl(A)
  2290. };
  2291. Klib.getFixedHref=function(A){var B=Klib.getUrlFromLink(A);
  2292. return B.url
  2293. }
  2294. }if(Klib.install("LinkScent",0.1)){Klib.LinkScent.LINK_TYPE_EMPTY=0;
  2295. Klib.LinkScent.LINK_TYPE_INTERNAL=1;
  2296. Klib.LinkScent.LINK_TYPE_SUBDOMAIN=2;
  2297. Klib.LinkScent.LINK_TYPE_EXTERNAL=3;
  2298. Klib.LinkScent.LINK_TYPE_NON_HTTP=4;
  2299. Klib.LinkScent.clueIconCache=new Klib.Cache.Obj("LinkScent.clueIconCache");
  2300. Klib.LinkScent.fileTypes={};
  2301. Klib.LinkScent.registeredProtocols=["http:","https:"];
  2302. Klib.LinkScent.fastClues=[];
  2303. Klib.LinkScent.currentLink=null;
  2304. Klib.LinkScent.isRegisteredProtocol=function(A){return Klib.inArray(A,Klib.LinkScent.registeredProtocols)
  2305. };
  2306. Klib.LinkScent.registerProtocol=function(A){if(A.match(/^\w+:$/)){if(!Klib.LinkScent.isRegisteredProtocol(A)){Klib.LinkScent.registeredProtocols.push(A)
  2307. }}else{Klib.error("Attempting to register an invalid protocol")
  2308. }};
  2309. Klib.LinkScent.updateNanoHint=function(C){var A=C.getAttribute("title");
  2310. if(Klib.Pref.get("NanoHint.enabled")){var E="";
  2311. for(var B=0;
  2312. B<Klib.Clue.current.length;
  2313. B++){var D=Klib.Clue.current[B];
  2314. E+=D.nanoHint(D,C)
  2315. }if(E){if(C.origTitle===undefined){C.origTitle=A;
  2316. if(A){E+="\n"+A
  2317. }}if(!C.nanoHint||(C.nanoHint!=E)){C.nanoHint=E;
  2318. C.setAttribute("title",E)
  2319. }}}else{if(C.origTitle!==undefined){if(A!=C.origTitle){C.setAttribute("title",C.origTitle);
  2320. delete C.origTitle;
  2321. delete C.nanoHint
  2322. }}}};
  2323. Klib.LinkScent.showCurrentLinksLinkscents=function(E){if(Klib.LinkScent.currentLink){var D=Klib.LinkScent.currentLink;
  2324. Klib.LinkScent.initLink(D,true);
  2325. Klib.Clue.initLink(D,true);
  2326. if(D.linkscent.allowed){Klib.LinkScent.showLinkscents(D);
  2327. if(!D.linkscent.isSafe){Klib.LinkScent.updateClueIcon(D)
  2328. }else{if(Klib.LinkScent.shouldPrefetchLink(D)){Klib.LinkScent.fetchLink(D)
  2329. }else{Klib.LinkScent.updateClueIcon(D)
  2330. }}if(Klib.Pref.get("Metadata.thumbnails.enabled",true)&&Klib.Pref.get("Thumbnails.prefetch",true)){Klib.Thumbnail.getImg(Klib.getFixedHref(D))
  2331. }}if(E){var F=Klib.LinkScent.getIconBlock(D.ownerDocument);
  2332. var B=Klib.getEles(".linkscent-icon",F);
  2333. for(var A=0;
  2334. A<B.length;
  2335. A++){var C=B[A];
  2336. if(C.linkscent.link!=D){Klib.setStyle(C,"display","none")
  2337. }}}}};
  2338. Klib.LinkScent.fadeDocLinkscents=function(F,B){Klib.clearTimer("fadeDocLinkscents");
  2339. if(B){Klib.setNamedTimer("fadeDocLinkscents",function(){Klib.LinkScent.fadeDocLinkscents(F)
  2340. },B)
  2341. }else{if(F&&F.linkscent&&F.linkscent.currentLinks&&F.linkscent.currentLinks.length){var A=[];
  2342. var D=Klib.ClueFrame.isVisible();
  2343. for(var C=0;
  2344. C<F.linkscent.currentLinks.length;
  2345. C++){var E=F.linkscent.currentLinks[C];
  2346. if(E==Klib.LinkScent.currentLink||(D&&E==Klib.Clue.currentEle)){A.push(E)
  2347. }else{Klib.LinkScent.fadeLinkscents(E)
  2348. }}F.linkscent.currentLinks=A
  2349. }}};
  2350. Klib.LinkScent.handleFadeOut=function(A){if(A.source){Klib.removeEvent(A.source,"fadeout");
  2351. Klib.setStyle(A.source,"display","none")
  2352. }};
  2353. Klib.LinkScent.fadeLinkscents=function(C){if(C&&C.linkscent&&!C.linkscent.timerFading){if(Klib.Pref.get("LinkScent.fadeEnabled")){for(var A=0;
  2354. A<C.linkscent.icons.length;
  2355. A++){var B=C.linkscent.icons[A];
  2356. Klib.addEvent(B,"fadeout",Klib.LinkScent.handleFadeOut);
  2357. Klib.Fade.fadeOut(B,Klib.Pref.get("Fade.linkscent"))
  2358. }}else{C.linkscent.timerFading=Klib.setTimer(function(){if(C.linkscent){for(var D=0;
  2359. D<C.linkscent.icons.length;
  2360. D++){var E=C.linkscent.icons[D];
  2361. Klib.setStyle(E,"display","none")
  2362. }}},300)
  2363. }}};
  2364. Klib.LinkScent.fadeInLinkscents=function(C){for(var A=0;
  2365. A<C.linkscent.icons.length;
  2366. A++){var B=C.linkscent.icons[A];
  2367. if(B.isClueIcon&&B.src==Klib.Image.pixel()){Klib.setStyle(B,"display","none")
  2368. }else{Klib.setStyle(B,"display","block");
  2369. if(Klib.Pref.get("LinkScent.fadeEnabled")){Klib.Fade.fadeIn(B,100)
  2370. }else{Klib.setStyle(B,"visibility","visible")
  2371. }}}};
  2372. Klib.LinkScent.showLinkscents=function(A){if(A&&A.linkscent&&A.linkscent.icons&&!A.linkscent.showing){A.linkscent.showing=true;
  2373. if(!Klib.inArray(A,A.ownerDocument.linkscent.currentLinks)){A.ownerDocument.linkscent.currentLinks.push(A)
  2374. }Klib.LinkScent.updateClueIcon(A);
  2375. Klib.LinkScent.fadeInLinkscents(A);
  2376. Klib.Tutorial.fireEvent(A,"linkscentShow");
  2377. A.linkscent.showing=false
  2378. }else{Klib.warning("Unable to showLinkscents()",A)
  2379. }};
  2380. Klib.LinkScent.repositionVisibleIcons=function(){var C=Klib.Clue.currentDoc;
  2381. if(!C){return 
  2382. }if(!C.defaultView&&!C.parentWindow){return 
  2383. }var A=(C.linkscent&&C.linkscent.currentLinks)?C.linkscent.currentLinks:[];
  2384. for(var B=0;
  2385. B<A.length;
  2386. B++){Klib.LinkScent.repositionIcons(A[B])
  2387. }};
  2388. Klib.LinkScent.startRepositionVisibleIconsTimer=function(){Klib.setInterval("repositionVisibleIcons",Klib.LinkScent.repositionVisibleIcons,200)
  2389. };
  2390. Klib.LinkScent.stopRepositionVisibleIconsTimer=function(){Klib.clearTimer("repositionVisibleIcons")
  2391. };
  2392. Klib.LinkScent.handleDocMouseWheel=function(A){var B=A.source;
  2393. if(A&&A.eventData&&A.eventData.doc){A.source=A.eventData.doc;
  2394. Klib.LinkScent.handleDocMouseMove(A)
  2395. }};
  2396. Klib.LinkScent.findLinkByUrl=function(E,D,F){var A=E.getElementsByTagName("a");
  2397. var C=A.length;
  2398. F=F||0;
  2399. var B=0;
  2400. while(1){if((F-B<0)&&(F+B>C)){return null
  2401. }else{if((F+B<C)&&A[F+B]&&A[F+B].href===D){return A[F+B]
  2402. }else{if((F-B>0)&&A[F-B]&&A[F-B].href===D){return A[F-B]
  2403. }}}B++
  2404. }};
  2405. Klib.LinkScent.findLinkFromEvent=function(A){var C=Klib.getParent(A.currTarget,"a",true);
  2406. var B=Klib.getParent(A.currTarget,"img",true);
  2407. if(C&&C.getAttribute("creator")=="SiteAdvisor"){return null
  2408. }if(C){return C
  2409. }else{if(B&&B.linkscent&&B.linkscent.link){return B.linkscent.link
  2410. }else{if(B&&B.getAttribute("interclue_link_href")){return Klib.LinkScent.findLinkByUrl(B.ownerDocument,B.getAttribute("interclue_link_href"),B.getAttribute("interclue_link_index"))
  2411. }else{return null
  2412. }}}};
  2413. Klib.LinkScent.handleDocMouseMove=function(A){if(Klib.Drag.dragging){return 
  2414. }var B=Klib.LinkScent.findLinkFromEvent(A);
  2415. Klib.LinkCursor.handleMouseMove(A,B);
  2416. if(!B){Klib.LinkScent.currentLink=null
  2417. }else{if(Klib.LinkScent.currentLink!=B){Klib.LinkScent.currentLink=B;
  2418. if(B&&B.linkscent&&B.linkscent.timerFading){Klib.clearTimer(B.linkscent.timerFading);
  2419. B.linkscent.timerFading=null;
  2420. B.ownerDocument.linkscent.currentLinks.push(B)
  2421. }}}if(!Klib.Timer.exists("fadeDocLinkscents")){var C=A.source;
  2422. Klib.setNamedTimer("fadeDocLinkscents",function(){if(C){Klib.LinkScent.fadeDocLinkscents(C)
  2423. }},Klib.Pref.get("LinkScent.fadeTime"))
  2424. }if(B){Klib.LinkScent.currentLinkX=A.screenX;
  2425. Klib.LinkScent.currentLinkY=A.screenY
  2426. }};
  2427. Klib.LinkScent.docAllowsLinkScents=function(A){return Klib.Clue.docAllowsClues(A)
  2428. };
  2429. Klib.LinkScent.prefetchFavicons=function(F){var A=Klib.Pref.get("LinkScent.prefetchFaviconsMax",10);
  2430. if(A&&F&&F.links&&F.links.length){var H=Klib.Url.parse(F.URL,"basedomain");
  2431. var B=F.links;
  2432. var G=0;
  2433. for(var C=0;
  2434. C<B.length;
  2435. C++){var D=B[C];
  2436. var E=Klib.Url.parse(Klib.getFixedHref(D),"basedomain");
  2437. if(E!=H){G+=Klib.FavIcon.prefetch(Klib.getFixedHref(D));
  2438. if((A>-1)&&(G>=A)){break
  2439. }}}}else{}};
  2440. Klib.LinkScent.prefetchLink2=function(A){if(A&&Klib.Pref.get("Clues.enabled")){Klib.LinkScent.initLink(A);
  2441. if(Klib.LinkScent.shouldPrefetchLink(A)){Klib.LinkScent.fetchLink(A,false,true)
  2442. }}};
  2443. Klib.LinkScent.prefetchSimilarLinks=function(A){Klib.LinkScent.prefetchLink2(Klib.ClueFrame.getNextSimilarLink(A,1));
  2444. Klib.LinkScent.prefetchLink2(Klib.ClueFrame.getNextSimilarLink(A,-1))
  2445. };
  2446. Klib.LinkScent.prefetchLink=function(A){var B=Klib.LinkScent.currentLink;
  2447. if(B&&Klib.Pref.get("Clues.enabled")){Klib.LinkScent.initLink(B);
  2448. if(Klib.LinkScent.shouldPrefetchLink(B)){Klib.LinkScent.fetchLink(Klib.LinkScent.currentLink)
  2449. }}};
  2450. Klib.LinkScent.initDoc=function(A){if(Klib.Pref.get("LinkScent.enabled")){if(!A.linkscent){A.linkscent={};
  2451. A.linkscent.linkcount=0;
  2452. A.linkscent.linksprocessed=0;
  2453. A.linkscent.iconcount=0;
  2454. A.linkscent.totalTime=0;
  2455. A.linkscent.linksinitalized=0;
  2456. A.linkscent.currentLinks=[];
  2457. if(Klib.LinkScent.docAllowsLinkScents(A)){Klib.Hover.addHover(A.body,Klib.LinkScent.prefetchLink,Klib.Pref.get("LinkScent.prefetchOnHoverDelay"));
  2458. Klib.Hover.addHover(A.body,Klib.LinkScent.showCurrentLinksLinkscents,Klib.Pref.get("LinkScent.hoverDelay"));
  2459. Klib.addEvent(A,"mousemove",Klib.LinkScent.handleDocMouseMove);
  2460. Klib.addEvent(Klib.getWin(A),"mousewheel",Klib.LinkScent.handleDocMouseWheel,{doc:A})
  2461. }Klib.FavIcon.updateFromDoc(A);
  2462. if(Klib.Pref.get("LinkScent.prefetchFavicons")){Klib.setNamedTimer("prefetchFavicons",function(){Klib.LinkScent.prefetchFavicons(A)
  2463. },1000)
  2464. }if(Klib.Pref.get("Clue.prefetchExternalPages")){Klib.setNamedTimer("prefetchExternalPages",function(){Klib.Clue.prefetchExternalPages(A)
  2465. },1500)
  2466. }}}};
  2467. Klib.LinkScent.updateStats=function(A){if(A.linkscent&&A.linkscent.totalTime){}};
  2468. Klib.LinkScent.isPaginationLink=function(A){if(A.linkscent.linkType!=Klib.LinkScent.LINK_TYPE_INTERNAL){return false
  2469. }var B=Klib.innerText(A,true).toLowerCase();
  2470. if(B.match(/^[^\w]*next[^\w]*$/)||B.match(/^[^\w]*prev[^\w]*$/)||B.match(/^[^\w]*previous[^\w]*$/)){return true
  2471. }return(B.match(/^\d{1,2}$/))?true:false
  2472. };
  2473. Klib.LinkScent.getLoadingIcon=function(){switch(Klib.Pref.get("LinkScent.progressIndicator")){case"animatedIcon":return Klib.skinUrl()+"/linkscentLoading.gif";
  2474. case"staticIcon":return Klib.skinUrl()+"/linkscentLoading.png";
  2475. case"cursor":return Klib.Image.pixel();
  2476. default:Klib.error("Invalid pref","LinkScent.progressIndicator",Klib.Pref.get("LinkScent.progressIndicator"));
  2477. break
  2478. }return Klib.Image.pixel()
  2479. };
  2480. Klib.LinkScent.updateFavIcon=function(B,C){if(B&&B.linkscent&&B.linkscent.favIcon&&!B.linkscent.useTinyIcons&&!B.linkscent.favIconSet){var A=Klib.FavIcon.getCurrFavIconUrl(Klib.getFixedHref(B));
  2481. if(A){Klib.setBackground(B.linkscent.favIcon,A)
  2482. }}};
  2483. Klib.LinkScent.refreshLink=function(C){var B=Klib.getFixedHref(C);
  2484. Klib.LinkScent.clueIconCache.remove(B);
  2485. var A=B.replace(/#.*$/,"");
  2486. Klib.HTMLDoc.cache.remove(A);
  2487. Klib.LinkScent.showLinkscents(C)
  2488. };
  2489. Klib.LinkScent.updateClueIcon=function(I,H,B){B=(B===undefined)?true:B;
  2490. Klib.LinkScent.updateFavIcon(I,H);
  2491. if(I&&I.linkscent&&I.linkscent.clueIcon&&!I.linkscent.failover){var D=Klib.LinkScent.getLoadingIcon();
  2492. var G=true;
  2493. var F=false;
  2494. var J="";
  2495. var A="";
  2496. var C=false;
  2497. var E=Klib.LinkScent.clueIconCache.get(Klib.getFixedHref(I));
  2498. if(E&&B){G=E.allowClueFrame;
  2499. F=E.fade;
  2500. J=E.src;
  2501. A=E.title
  2502. }else{if(I.linkscent.precaching){J=D;
  2503. G=true;
  2504. F=true
  2505. }if(I.linkscent.htmldoc){if(I.linkscent.htmldoc.error&&I.linkscent.htmldoc.cacheOnError){switch(I.linkscent.htmldoc.status){case Klib.Ajax.REQUEST_TIMED_OUT:J=Klib.skinUrl()+"/linkscentTimeout.png";
  2506. A=Klib.string("ajax.error.request.timed.out");
  2507. G=true;
  2508. C=true;
  2509. break;
  2510. case Klib.Ajax.ERROR_UNKNOWN:case Klib.Ajax.STATUS_ABORTED:break;
  2511. case 403:J=Klib.skinUrl()+"/linkscentError.png";
  2512. A=I.linkscent.htmldoc.status+":"+I.linkscent.htmldoc.statusText;
  2513. G=true;
  2514. C=false;
  2515. break;
  2516. default:J=Klib.skinUrl()+"/linkscentError.png";
  2517. A=I.linkscent.htmldoc.status+":"+I.linkscent.htmldoc.statusText;
  2518. G=true;
  2519. C=true;
  2520. break
  2521. }}}if(H){if(H.state==Klib.Clue.STATE_RETRIEVING){J=D;
  2522. A=Klib.string("clueframe.status.retrieving");
  2523. G=true;
  2524. F=true
  2525. }else{if(H.state==Klib.Clue.STATE_PARSING){A="";
  2526. G=true
  2527. }else{if(H.state==Klib.Clue.STATE_ERROR){J=Klib.skinUrl()+"/linkscentError.png";
  2528. A=(H.error)?H.error:Klib.string("error");
  2529. G=true
  2530. }else{if(H.state==Klib.Clue.STATE_COMPLETE){J="";
  2531. A=""
  2532. }}}}}if(I.linkscent.isSafe===false&&(I.protocol=="http:"||I.protocol=="https:")){J=Klib.skinUrl()+"/linkscentAction.png";
  2533. A=Klib.string("clue.unsafeurl.title")
  2534. }if(C){Klib.LinkScent.clueIconCache.add(Klib.getFixedHref(I),{src:J,title:A,allowClueFrame:G,fade:F})
  2535. }}I.linkscent.allowClueFrame=G;
  2536. if(J==""){Klib.LinkScent.hideLoading(I)
  2537. }else{if(J==D){Klib.LinkScent.showLoading(I,D)
  2538. }else{if(Klib.Pref.get("LinkScent.progressIndicator")=="cursor"){Klib.LinkScent.restoreDefaultCursor(I)
  2539. }Klib.setProp(I.linkscent.clueIcon,"src",J);
  2540. Klib.setStyle(I.linkscent.clueIcon,"display","block")
  2541. }}}};
  2542. Klib.LinkScent.hideLoading=function(B){var A=B.linkscent.clueIcon;
  2543. Klib.setProp(A,"src",Klib.Image.pixel());
  2544. Klib.setStyle(A,"display","none");
  2545. if(Klib.Pref.get("LinkScent.progressIndicator")=="cursor"){Klib.LinkScent.restoreDefaultCursor(B)
  2546. }};
  2547. Klib.LinkScent.showLoading=function(C,B){var A=C.linkscent.clueIcon;
  2548. Klib.setProp(A,"src",B);
  2549. Klib.setStyle(A,"display","block")
  2550. };
  2551. Klib.LinkScent.handleClueStateChange=function(A){if(A.link&&A.state&&(A.state!==Klib.Clue.STATE_LOADED)&&!A.extractContentFailed){Klib.LinkScent.updateClueIcon(A.link,A)
  2552. }};
  2553. Klib.LinkScent.getLinkType=function(B){if(!B.href){return Klib.LinkScent.LINK_TYPE_EMPTY
  2554. }else{var C=Klib.Url.parse(Klib.getFixedHref(B));
  2555. if(C.protocol=="http:"||C.protocol=="https:"){var A=Klib.Url.parse(B.ownerDocument.URL);
  2556. if(A){if(C.domain==A.domain){return Klib.LinkScent.LINK_TYPE_INTERNAL
  2557. }if(C.basedomain==A.basedomain){return Klib.LinkScent.LINK_TYPE_SUBDOMAIN
  2558. }}return Klib.LinkScent.LINK_TYPE_EXTERNAL
  2559. }else{return Klib.LinkScent.LINK_TYPE_NON_HTTP
  2560. }}};
  2561. Klib.LinkScent.isRegisteredFileType=function(A){return(A.linkscent.fileExt&&typeof Klib.LinkScent.fileTypes[A.linkscent.fileExt]!=="undefined")
  2562. };
  2563. Klib.LinkScent.isImageLink=function(A){return((A.getElementsByTagName("img").length>0)&&(Klib.innerText(A,true,true)==""))
  2564. };
  2565. Klib.LinkScent.attachWithFuzzyLogic=function(C){for(var B=0;
  2566. B<Klib.Clue.current.length;
  2567. B++){var E=Klib.Clue.current[B];
  2568. if(E.showFuzzyLinkclue&&E.isValidLink(C)){return true
  2569. }}var A=true;
  2570. var D="";
  2571. if(!Klib.Pref.get("LinkScent.allowOnPaginationLinks")&&Klib.LinkScent.isPaginationLink(C)){D="isPaginationLink";
  2572. A=false
  2573. }else{if(Klib.LinkScent.isImageLink(C)){D="Pref: attachToImageLinks";
  2574. A=(Klib.Pref.get("ImageLinks.show")=="icon")
  2575. }else{if(Klib.innerText(C,true,true)==""){D="Pref: ignoreEmptyLinks";
  2576. A=false
  2577. }else{if(Klib.LinkScent.isRegisteredFileType(C)){D="registered file extension";
  2578. A=true
  2579. }else{if(Klib.LinkScent.isTargetedLink(C)){D="isTargetedLink";
  2580. A=Klib.Pref.get("LinkScent.allowOnTargetedLinks")
  2581. }else{if(Klib.LinkScent.isInternalNavigationLink(C)){D="isInternalNavigationLink";
  2582. A=false
  2583. }else{D="no reason";
  2584. A=true
  2585. }}}}}}return A
  2586. };
  2587. Klib.LinkScent.getLinkFileExt=function(A){if(A&&A.href&&A.protocol&&(A.protocol=="http:"||A.protocol=="https:")){return Klib.Url.parse(Klib.getFixedHref(A),"extension")
  2588. }return""
  2589. };
  2590. Klib.LinkScent.restoreDefaultCursor=function(A){if(A.linkscent){A.linkscent.linkCursor=A.linkscent.defaultCursor||""
  2591. }};
  2592. Klib.LinkScent.applyCursors=function(B){if(B.linkscent.allowCursors){for(var A=0;
  2593. A<Klib.Clue.current.length;
  2594. A++){var C=Klib.Clue.current[A];
  2595. if(C.enabled&&C.cursor&&C.isValidLink(B)){B.linkscent.defaultCursor=C.cursor;
  2596. Klib.LinkCursor.applyCursor(B,C.cursor,true);
  2597. Klib.Tutorial.fireEvent(B,"applyCursors");
  2598. return 
  2599. }}}};
  2600. Klib.LinkScent.isHashLink=function(A){if(A.getAttribute("href")=="#"){return true
  2601. }else{if(A.href){return(A.href==(A.ownerDocument.URL.replace(/#.*$/)+"#"))
  2602. }else{return false
  2603. }}};
  2604. Klib.LinkScent.getCursorUrl=function(A,B){B=B||Klib.skinUrl()+"/cursors";
  2605. return B+"/"+A+".cur"
  2606. };
  2607. Klib.LinkScent.subdomainIsUserSpecific=function(C){var A=["livejournal.com","blogspot.com","typepad.com","vox.com","stumbleupon.com","dreamhosters.com"];
  2608. var B=Klib.Url.parse(C);
  2609. if(B.success&&B.basedomain){return Klib.inArray(A,B.basedomain)
  2610. }return false
  2611. };
  2612. Klib.LinkScent.shouldUseTinyIcons=function(B){var A=Klib.getFixedHref(B);
  2613. if(!Klib.Pref.get("LinkScent.allowTinyIcons")){return false
  2614. }if(B.href&&B.protocol=="javascript:"){return true
  2615. }else{if(B.linkscent.linkType!=Klib.LinkScent.LINK_TYPE_INTERNAL&&B.linkscent.linkType!=Klib.LinkScent.LINK_TYPE_SUBDOMAIN){return false
  2616. }else{if(Klib.LinkScent.isRegisteredFileType(B)){return false
  2617. }else{if(A.match(/#.+$/)){return false
  2618. }else{if(B.linkscent.linkType==Klib.LinkScent.LINK_TYPE_SUBDOMAIN&&Klib.LinkScent.subdomainIsUserSpecific(A)){return false
  2619. }else{if(Klib.wordCount(Klib.innerText(B,true))>3){return false
  2620. }else{return true
  2621. }}}}}}};
  2622. Klib.LinkScent.setupLink=function(B){if(!B.linkscent){B.linkscent={};
  2623. B.linkscent.iconcount=0;
  2624. B.linkscent.icons=[];
  2625. B.linkscent.current=[];
  2626. B.linkscent.allowed=false;
  2627. B.linkscent.allowClueFrame=true;
  2628. B.linkscent.allowCursors=true;
  2629. B.linkscent.disableClues=B.getAttribute("interclue-disable-clues")?true:false;
  2630. B.linkscent.linkType=Klib.LinkScent.getLinkType(B);
  2631. B.linkscent.isSafe=Klib.Security.isSafeLink(B);
  2632. B.linkscent.filename="";
  2633. B.linkscent.fileExt="";
  2634. if(B.href){var A=Klib.getUrlFromLink(B);
  2635. if(A.success&&(A.protocol=="http:"||A.protocol=="https:")&&!A.anchor&&!A.query){B.linkscent.filename=A.filename;
  2636. B.linkscent.fileExt=A.extension
  2637. }}B.linkscent.useTinyIcons=Klib.LinkScent.shouldUseTinyIcons(B)
  2638. }};
  2639. Klib.LinkScent.isScriptLink=function(B){var A=Klib.getUrlFromLink(B);
  2640. return(A.protocol=="javascript:")
  2641. };
  2642. Klib.LinkScent.initLink=function(F,A){var E=Klib.timestamp(true);
  2643. Klib.LinkScent.setupLink(F);
  2644. if(!F.linkscent.onClueStateChange){F.linkscent.onClueStateChange=Klib.LinkScent.handleClueStateChange;
  2645. F.linkscent.allowCursors=((Klib.Pref.get("ImageLinks.show")=="cursor")||!Klib.LinkScent.isImageLink(F));
  2646. var H=F.ownerDocument;
  2647. H.linkscent=H.linkscent||{};
  2648. H.linkscent.linksprocessed=H.linkscent.linksprocessed||0;
  2649. H.linkscent.linksprocessed++;
  2650. if(Klib.LinkScent.isHashLink(F)){F.setAttribute("href","javascript:;")
  2651. }}var B=true;
  2652. if(!Klib.Pref.get("LinkScent.enabled")){B=false
  2653. }else{if(!Klib.Security.isDocEnabled(F.ownerDocument)){B=false
  2654. }else{if(!F.href){B=false
  2655. }else{if(Klib.hasClass(F,"noclues")){B=false
  2656. }}}}if(B){F.linkscent.allowed=true;
  2657. Klib.profile("LinkScent.initLink - start -",F.href);
  2658. Klib.addEvent(F,"mouseover",Klib.LinkScent.repositionIcons);
  2659. if(A||(Klib.Pref.get("Clue.default.linkScent","hide")!="hide")){var D=0;
  2660. for(var C=0;
  2661. C<Klib.Clue.current.length;
  2662. C++){var G=Klib.Clue.current[C];
  2663. if(G.enabled&&G.isValidLink(F)){D++;
  2664. if((G.linkscent!="none")&&(Klib.Pref.get("Clue."+G.id+".linkScent","hide")!="none")){if(A||(Klib.Pref.get("Clue."+G.id+".linkScent","hide")!="hide")){Klib.LinkScent.appendIcon(F,G)
  2665. }}}}if(D&&!F.linkscent.iconcount){if(A||(Klib.Pref.get("Clue.default.linkScent","hide")!="hide")){Klib.LinkScent.appendIcon(F,"default")
  2666. }}if(D&&A){Klib.LinkScent.appendClueIcon(F)
  2667. }}Klib.profile("LinkScent.initLink - finish")
  2668. }F.ownerDocument.linkscent.totalTime+=(Klib.timestamp(true)-E)
  2669. };
  2670. Klib.LinkScent.handleClick=function(A){A.halt();
  2671. var B=A.source;
  2672. if(B&&B.linkscent&&B.linkscentlink&&B.linkscent.link.href){Klib.LinkScent.refreshLink(B.linkscent.link)
  2673. }if(B&&B.getAttribute("clueid")){var C=Klib.Clue.getClue(B.getAttribute("clueid"));
  2674. if(C&&C.onLinkscentClick){C.onLinkscentClick(B.linkscent.link);
  2675. return 
  2676. }}Klib.Clue.handleLinkScentClick(A)
  2677. };
  2678. Klib.LinkScent.refreshFastClues=function(){Klib.LinkScent.fastClues=[];
  2679. for(var B=0;
  2680. B<Klib.Clue.current.length;
  2681. B++){var C=Klib.Clue.current[B];
  2682. var A=Klib.Pref.get("Clue."+C.id+".linkScent",C.linkscent);
  2683. if(C.enabled&&(C.linkscent!="none")&&(A=="fade")){Klib.LinkScent.fastClues.push(C)
  2684. }}};
  2685. Klib.getNodes=function(D){var A=[];
  2686. for(var B=0;
  2687. B<D.childNodes.length;
  2688. B++){var C=D.childNodes[B];
  2689. A.push(C);
  2690. if(C.childNodes){A=A.concat(Klib.getNodes(C))
  2691. }}return A
  2692. };
  2693. Klib.LinkScent.getBodyScreenPosition=function(A){A.interclue=A.interclue||{};
  2694. if(!A.interclue.origin){A.interclue.origin=A.createElement("object");
  2695. Klib.setCSS(A.interclue.origin,Klib.getStyles("linkscent-origin"));
  2696. A.body.appendChild(A.interclue.origin)
  2697. }return Klib.getBox(A.interclue.origin)
  2698. };
  2699. Klib.LinkScent.willCoverNextLink=function(D){var B=null;
  2700. var F=D.ownerDocument;
  2701. for(var C=0;
  2702. C<F.links.length;
  2703. C++){if(F.links[C]==D){if((C+1)<F.links.length){B=F.links[C+1]
  2704. }}}if(B){var A=Klib.getRect(D);
  2705. var E=Klib.getRect(B);
  2706. if((E.width<20)&&(Math.abs(A.right-E.left)<=16)&&(A.bottom==E.bottom)){return true
  2707. }}return false
  2708. };
  2709. Klib.docRenderMode=function(A){if(A.compatMode&&A.compatMode=="CSS1Compat"&&A.doctype&&A.doctype.publicId&&A.doctype.publicId.match(/transitional|frameset/i)){return"almost standards"
  2710. }else{if(A.compatMode&&A.compatMode=="CSS1Compat"){return"standards"
  2711. }else{return"quirks"
  2712. }}};
  2713. Klib.LinkScent.precacheOnHead=function(A){if(!Klib.Pref.get("Clue.prefetchContent")){return false
  2714. }else{if(A.headers&&A.headers.content_type&&Klib.isHTMLHeader(A.headers)){return true
  2715. }else{return false
  2716. }}};
  2717. Klib.LinkScent.precacheReceive=function(B,A){if(A.link){var C=A.link;
  2718. C.linkscent.precaching=false;
  2719. C.linkscent.htmldoc=B;
  2720. if(!B.cacheOnError&&B.error&&B.link&&B.link.linkscent&&B.link.linkscent.precached){B.link.linkscent.precached=false
  2721. }Klib.LinkScent.updateClueIcon(C,null,false);
  2722. if(!B.error){if(B.origHTML){Klib.FavIcon.updateFromHtml(B.origHTML,B.url)
  2723. }}if(C.linkscent.forceRefresh){Klib.Clue.currentEle=C;
  2724. Klib.Clue.show(C.linkscent.forceRefresh)
  2725. }}else{Klib.error("LinkScent.precacheReceive:Cannot find link that activated precache event")
  2726. }};
  2727. Klib.LinkScent.shouldPrefetchLink=function(B){if(B){Klib.LinkScent.initLink(B);
  2728. var A=Klib.getFixedHref(B);
  2729. if(A&&A.indexOf("?")>-1){return false
  2730. }if((!B.linkscent.precached)&&B.linkscent.allowed&&B.protocol&&(B.protocol.toLowerCase()=="http:"||(Klib.LinkScent.isInternalLink(B)))&&!Klib.Url.isLocal(A)&&Klib.Pref.get("Clues.enabled")){return true
  2731. }}return false
  2732. };
  2733. Klib.LinkScent.haltOtherRequests=function(C){C=Klib.Url.noHash(C);
  2734. var B=Klib.HTMLDoc.cache.items;
  2735. for(var D in B){var A=B[D];
  2736. if(A.state<Klib.HTMLDoc.STATE_COMPLETE&&A.urlPage!=C){A.halt()
  2737. }}};
  2738. Klib.LinkScent.fetchLink=function(D,E,B){Klib.LinkScent.setupLink(D);
  2739. D.linkscent.precached=true;
  2740. var C=Klib.getFixedHref(D);
  2741. if(E||Klib.Pref.get("Clue.prefetchHead")||Klib.Pref.get("Clue.prefetchContent")){if(!D.linkscent.precaching){D.linkscent.precaching=true;
  2742. if(D.protocol&&(D.protocol.toLowerCase()=="http:"||D.protocol.toLowerCase()=="https:")){var A=new Klib.HTMLDoc.Obj(C);
  2743. A.cacheOnError=B?false:true;
  2744. A.fetchHead=E||B||Klib.Pref.get("Clue.prefetchHead",true);
  2745. A.fetchContent=E||B||Klib.Pref.get("Clue.prefetchContent");
  2746. A.maxContentLength=Klib.Pref.getInt("Clue.maxContentLength")*1024;
  2747. A.parseHTML=E||B||Klib.Pref.get("Clue.prefetchParseHTML");
  2748. if(B&&Klib.Pref.get("Privacy.addXClueHeaders",true)){A.requestHeaders["X-clue"]="prefetch"
  2749. }if(B){A.requestHeaders["X-moz"]="prefetch"
  2750. }A.addEvent("complete",Klib.LinkScent.precacheReceive,{link:D});
  2751. A.link=D;
  2752. D.linkscent.htmldoc=A;
  2753. Klib.LinkScent.updateClueIcon(D);
  2754. if(D.linkscent.isSafe){A.fetch()
  2755. }if(!B&&Klib.Pref.get("Metadata.delicious.enabled")&&!Klib.Clue.isPrivateUrl(C)){Klib.Delicious.fetchTags(C)
  2756. }}else{D.linkscent.precaching=false;
  2757. Klib.LinkScent.updateClueIcon(D)
  2758. }}}else{Klib.LinkScent.updateClueIcon(D)
  2759. }};
  2760. Klib.LinkScent.isWrappedLink=function(B){if(Klib.getStyle(B,"display")=="inline"){var C=Klib.getStyle(B,"marginTop","int")+Klib.getStyle(B,"marginBottom","int");
  2761. var D=Klib.getStyle(B,"paddingTop","int")+Klib.getStyle(B,"paddingBottom","int");
  2762. var A=Klib.getStyle(B,"borderTop","int")+Klib.getStyle(B,"borderBottom","int");
  2763. var E=Klib.getStyle(B,"lineHeight","int");
  2764. if(!E){E=Klib.getStyle(B,"fontSize","int")
  2765. }if(!E){return false
  2766. }return(B.offsetHeight>=((E*1.5)+C+D+A))
  2767. }else{return false
  2768. }};
  2769. Klib.LinkScent.calculateEndOfText=function(D){var U=D.ownerDocument;
  2770. U.interclue=U.interclue||{};
  2771. if(!U.interclue.linkscentOrigin){U.interclue.linkscentOrigin=U.createElement("object");
  2772. Klib.setCSS(U.interclue.linkscentOrigin,Klib.getStyles("linkscent-origin"));
  2773. U.body.appendChild(U.interclue.linkscentOrigin)
  2774. }var T=U.interclue.linkscentOrigin;
  2775. var N=U.createElement("object");
  2776. Klib.setCSS(N,Klib.getStyles("linkscent-positioner"));
  2777. var F;
  2778. var A=false;
  2779. var B=null;
  2780. var K=Klib.getNodes(D);
  2781. var J=["noscript","script","style","textarea"];
  2782. for(var O=K.length-1;
  2783. O>=0;
  2784. O--){var L=K[O];
  2785. if((L.nodeType==Klib.NODE_TYPE_TEXT)&&(Klib.trim(L.data,true)!="")&&L.parentNode.tagName&&(!Klib.inArray(L.parentNode.tagName.toLowerCase(),J))){var P=L.data.match(/((\s)|( (;)?))+$/i);
  2786. if(P){L.data=L.data.replace(/((\s)|( (;)?))+$/i,"");
  2787. Klib.insertAfter(N,L);
  2788. var E=D.ownerDocument.createTextNode(P[0]);
  2789. Klib.insertAfter(E,N)
  2790. }else{Klib.insertAfter(N,L)
  2791. }A=true;
  2792. break
  2793. }else{if(L.tagName&&(L.tagName=="IMG")){F=Klib.getBox2(L);
  2794. break
  2795. }}}if(!A&&!F){F=Klib.getBox2(D)
  2796. }var H=Klib.getBox2(T);
  2797. F=F||Klib.getBox2(N);
  2798. var Q=Klib.getBox2(D);
  2799. function S(W,V){V.right=V.left+V.width;
  2800. V.bottom=V.top+V.height;
  2801. W.right=W.left+W.width;
  2802. W.bottom=W.top+W.height;
  2803. if(W.left<V.left||W.left>V.right){W.left=V.right;
  2804. if(W.right<W.left){W.right=W.left
  2805. }}W.right=Klib.limit(W.right,V.left,V.right);
  2806. W.top=Klib.limit(W.top,V.top,V.bottom);
  2807. W.bottom=Klib.limit(W.bottom,V.top,V.bottom);
  2808. W.width=(W.right>W.left)?(W.right-W.left):0;
  2809. W.height=(W.bottom>W.top)?(W.bottom-W.top):0;
  2810. return W
  2811. }var G=N;
  2812. while(G&&G.nodeType==Klib.NODE_TYPE_ELEMENT&&G!=U.body){var C=Klib.getBox2(G);
  2813. if(C){if(C.width&&C.height){var M=Klib.clone(F);
  2814. F=S(F,C);
  2815. if(F.right!=(M.width+M.left)){}}var I=Klib.getStyle(G,"float");
  2816. if(I=="left"||I=="right"){break
  2817. }var R=Klib.getStyle(G,"position");
  2818. if(R=="fixed"||R=="absolute"){break
  2819. }G=G.parentNode
  2820. }else{break
  2821. }}F.top-=H.top;
  2822. F.left-=H.left;
  2823. Klib.removeEle(N);
  2824. return Klib.rect(F.left,F.top,F.width,F.height)
  2825. };
  2826. Klib.LinkScent.getNextLink=function(C){var A=C.ownerDocument.links;
  2827. for(var B=0;
  2828. B<A.length-1;
  2829. B++){if(A[B]===C){return A[B+1]
  2830. }}return null
  2831. };
  2832. Klib.LinkScent.repositionIcons=function(G,B){var O;
  2833. var H;
  2834. var X;
  2835. G=G.isEvent?G.source:G;
  2836. var b=G.ownerDocument;
  2837. var C=2;
  2838. var Q=G.linkscent.useTinyIcons?10:16;
  2839. var Y=G.linkscent.useTinyIcons?10:16;
  2840. var N=(Klib.isFirefox3&&Klib.docRenderMode(G.ownerDocument)=="standards")?-2:2;
  2841. var M=0;
  2842. if(Klib.getProp(G,"linkscent.icons.length",0)>0){var a=Klib.getAbsRect(G);
  2843. var P=Klib.getStyle(G,"direction");
  2844. P=(P)?P.toLowerCase():"ltr";
  2845. if(!G.linkscent.rect||(G.linkscent.rect.width!=a.width)||(G.linkscent.rect.height!=a.height)){var D=Klib.LinkScent.calculateEndOfText(G);
  2846. if(!G.linkscent.useTinyIcons&&Klib.Pref.get("LinkScent.verticallyAlignCloselyPackedLinks")){if(typeof G.linkscent.nextLink=="undefined"){G.linkscent.nextLink=false;
  2847. G.linkscent.prevLink=false;
  2848. for(var S=0;
  2849. S<b.links.length;
  2850. S++){if(b.links[S]==G){G.linkscent.nextLink=(S<(b.links.length-1))?b.links[S+1]:false;
  2851. G.linkscent.prevLink=(S>0)?b.links[S-1]:false;
  2852. break
  2853. }}}if(G.linkscent.nextLink){var R=Klib.getAbsRect(G.linkscent.nextLink);
  2854. var Z=3;
  2855. if(((R.left-a.right)<=Klib.Pref.get("LinkScent.position.nextLinkOffset"))&&Klib.lineIntersectsLine(a.top,a.bottom-Z,R.top,R.bottom)){var E=Klib.rect(D.left+C,D.bottom-Y+N,(Q*1)+C,Y);
  2856. if(Klib.rectInRect(E,R)){G.linkscent.isCloselyPackedLink=true
  2857. }}}if(G.linkscent.isCloselyPackedLink&&!Klib.LinkScent.isWrappedLink(G)){M-=(Q+C);
  2858. if(D.top>(Y*2)){var A=Klib.getStyle(G,"fontSize","int")||Y;
  2859. N-=A
  2860. }else{N+=Y
  2861. }}}if(G.linkscent.useTinyIcons&&!G.linkscent.isCloselyPackedLink){N-=parseInt(Klib.getStyle(G,"fontSize","int")*0.8)
  2862. }M+=(parseInt(G.getAttribute("interclue_linkclue_offset_x"))||0);
  2863. N+=(parseInt(G.getAttribute("interclue_linkclue_offset_y"))||0);
  2864. var L=false;
  2865. if(top.cpvw_objOverlay&&(G.protocol=="http:"||G.protocol=="https:")){try{var K=top.cpvw_siteManager.isIncludedSite(b.URL);
  2866. if(K[0]===true){L=true;
  2867. M+=18
  2868. }}catch(W){Klib.warning("cooliris.isIncludedSite() threw an error",W)
  2869. }}if(top.SiteAdvisorFirefoxExtension){var U=Klib.LinkScent.getNextLink(G);
  2870. if(U&&U.getAttribute("creator")=="SiteAdvisor"){M+=L?3:21
  2871. }}for(var S=0;
  2872. S<G.linkscent.icons.length;
  2873. S++){X=G.linkscent.icons[S];
  2874. H=((D.top+D.height)-Y)+N;
  2875. if(P=="rtl"){O=(D.left-C)-((S+1)*(Q+C))+M
  2876. }else{O=(D.right)+(C+(S*(Q+C)))+M
  2877. }Klib.setStyle(X,"position","absolute");
  2878. Klib.setStyle(X,"left",O+"px");
  2879. Klib.setStyle(X,"top",H+"px");
  2880. X.linkscent.lastLeft=O;
  2881. X.linkscent.lastTop=H;
  2882. if(S==0){G.linkscent.firstIconLeft=O;
  2883. G.linkscent.firstIconTop=H
  2884. }}}else{if((Math.abs(G.linkscent.rect.left-a.left)>1)||(Math.abs(G.linkscent.rect.top-a.top)>1)){var V=G.linkscent.rect.left-a.left;
  2885. var T=G.linkscent.rect.top-a.top;
  2886. for(var S=0;
  2887. S<G.linkscent.icons.length;
  2888. S++){X=G.linkscent.icons[S];
  2889. O=X.linkscent.lastLeft-V;
  2890. H=X.linkscent.lastTop-T;
  2891. Klib.setStyle(X,"position","absolute");
  2892. Klib.setStyle(X,"left",O+"px");
  2893. Klib.setStyle(X,"top",H+"px");
  2894. X.linkscent.lastLeft=O;
  2895. X.linkscent.lastTop=H
  2896. }}else{if(B){for(var S=1;
  2897. S<G.linkscent.icons.length;
  2898. S++){X=G.linkscent.icons[S];
  2899. var I=G.linkscent.icons[S-1];
  2900. H=I.linkscent.lastTop;
  2901. if(P=="rtl"){O=I.linkscent.lastLeft-(Q+C)
  2902. }else{O=I.linkscent.lastLeft+Q+C
  2903. }Klib.setStyle(X,"position","absolute");
  2904. Klib.setStyle(X,"left",O+"px");
  2905. Klib.setStyle(X,"top",H+"px");
  2906. X.linkscent.lastLeft=O;
  2907. X.linkscent.lastTop=H
  2908. }if(G.linkscent.isCloselyPackedLink){var J=G.linkscent.icons.length;
  2909. for(var S=0;
  2910. S<G.linkscent.icons.length;
  2911. S++){X=G.linkscent.icons[S];
  2912. H=G.linkscent.firstIconTop;
  2913. var F=J-2;
  2914. O=G.linkscent.firstIconLeft-((F-S)*(Q+C));
  2915. Klib.setStyle(X,"position","absolute");
  2916. Klib.setStyle(X,"left",O+"px");
  2917. Klib.setStyle(X,"top",H+"px");
  2918. X.linkscent.lastLeft=O;
  2919. X.linkscent.lastTop=H
  2920. }}}}}G.linkscent.rect=a
  2921. }};
  2922. Klib.LinkScent.getIconBlock=function(A){if(!A.linkscent){Klib.LinkScent.initDoc(A)
  2923. }if(!A.linkscent.iconblock){var B=A.createElement("div");
  2924. B.className="linkscent-iconblock";
  2925. Klib.setCSS(B,Klib.getStyles("linkscent-iconblock"));
  2926. A.body.appendChild(B);
  2927. A.linkscent.iconblock=B
  2928. }return A.linkscent.iconblock
  2929. };
  2930. Klib.LinkScent.insertIcon=function(D,C){var E=Klib.LinkScent.getIconBlock(D.ownerDocument);
  2931. if(E){E.appendChild(C);
  2932. C.linkscent=C.linkscent||{};
  2933. C.linkscent.link=D;
  2934. D.linkscent.icons=D.linkscent.icons||[];
  2935. if(D.linkscent.clueIcon){var B=[];
  2936. for(var A=0;
  2937. A<D.linkscent.icons.length;
  2938. A++){if(D.linkscent.icons[A]!=D.linkscent.clueIcon){B.push(D.linkscent.icons[A])
  2939. }}B.push(C);
  2940. B.push(D.linkscent.clueIcon);
  2941. D.linkscent.icons=B
  2942. }else{D.linkscent.icons.push(C)
  2943. }D.linkscent.iconcount=D.linkscent.icons.length;
  2944. Klib.LinkScent.repositionIcons(D,true);
  2945. return true
  2946. }else{Klib.error("Unable to get document linkscent iconblock");
  2947. return false
  2948. }};
  2949. Klib.LinkScent.insertIconIntoLink=function(F,G){var E=null;
  2950. var B=Klib.getNodes(F);
  2951. var H=["noscript","script","style","textarea"];
  2952. for(var D=B.length-1;
  2953. D>=0;
  2954. D--){var C=B[D];
  2955. if((C.nodeType==Klib.NODE_TYPE_TEXT)&&(Klib.trim(C.data,true)!="")&&C.parentNode.tagName&&(!Klib.inArray(C.parentNode.tagName.toLowerCase(),H))){var A=C.data.match(/((\s)|( (;)?))+$/i);
  2956. if(A){C.data=C.data.replace(/((\s)|( (;)?))+$/i,"");
  2957. Klib.insertAfter(G,C);
  2958. var I=F.ownerDocument.createTextNode(A[0]);
  2959. Klib.insertAfter(I,G)
  2960. }else{Klib.insertAfter(G,C)
  2961. }return 
  2962. }}F.appendChild(G)
  2963. };
  2964. Klib.LinkScent.getInterclueBox=function(A){A.interclue=A.interclue||{};
  2965. if(!A.interclue.mainBox){A.interclue.mainBox=A.createElement("div");
  2966. Klib.setCSS(A.interclue.mainBox,Klib.getStyles("interclue-main-box"));
  2967. A.body.appendChild(A.interclue.mainBox)
  2968. }return A.interclue.mainBox
  2969. };
  2970. Klib.LinkScent.createIcon=function(B){var A=B.ownerDocument.createElement("img");
  2971. A.linkscent={};
  2972. A.linkscent.link=B;
  2973. A.linkscent.visibility="hide";
  2974. A.className="linkscent-icon";
  2975. if(B.linkscent.useTinyIcons){Klib.setCSS(A,Klib.getStyles("linkscent-icon-tiny"))
  2976. }else{Klib.setCSS(A,Klib.getStyles("linkscent-icon"))
  2977. }Klib.setStyle(A,"visibility","hidden");
  2978. Klib.setStyle(A,"display","none");
  2979. if(Klib.isIE){Klib.setStyle(A,"background",'transparent url("'+Klib.Image.pixel()+'")')
  2980. }Klib.addEvent(A,"click",Klib.LinkScent.handleClick);
  2981. return A
  2982. };
  2983. Klib.LinkScent.appendFavIcon=function(B){if(!B.linkscent.favIcon&&Klib.Pref.get("LinkScent.showFavIcon")){var A=Klib.LinkScent.createIcon(B);
  2984. A.src=Klib.Image.pixel();
  2985. var C=Klib.FavIcon.getCurrFavIconUrl(Klib.getFixedHref(B));
  2986. if(B.linkscent.useTinyIcons){B.linkscent.favIconUrl=Klib.skinUrl()+(Klib.LinkScent.isInternalLink(B)?"/linkscentDefaultTiny.png":"/linkscentExternalTiny.png");
  2987. Klib.setBackground(A,B.linkscent.favIconUrl)
  2988. }else{if(C){B.linkscent.favIconUrl=C;
  2989. Klib.setBackground(A,B.linkscent.favIconUrl)
  2990. }else{B.linkscent.favIconUrl=Klib.skinUrl()+(Klib.LinkScent.isInternalLink(B)?"/linkscentDefault.png":"/linkscentExternal.png");
  2991. Klib.setBackground(A,B.linkscent.favIconUrl);
  2992. if(B.protocol=="http:"){Klib.FavIcon.fetch(Klib.getFixedHref(B),function(D){if(D.exists){try{Klib.setBackground(A,D.url)
  2993. }catch(E){}}})
  2994. }}}Klib.LinkScent.insertIcon(B,A);
  2995. A.setAttribute("clueid","favIcon");
  2996. B.linkscent.current.push("favIcon");
  2997. B.linkscent.favIcon=A
  2998. }};
  2999. Klib.LinkScent.appendClueIcon=function(B){if(!B.linkscent.clueIcon){var A=Klib.LinkScent.createIcon(B);
  3000. A.src=Klib.Image.pixel();
  3001. A.isClueIcon=true;
  3002. Klib.LinkScent.insertIcon(B,A);
  3003. Klib.setStyle(A,"display","none");
  3004. A.setAttribute("clueid","clueIcon");
  3005. B.linkscent.current.push("clueIcon");
  3006. B.linkscent.clueIcon=A
  3007. }};
  3008. Klib.LinkScent.appendIcon=function(B,C){if(B.linkscent.iconcount==0){if(B.protocol=="http:"||B.protocol=="https:"){Klib.LinkScent.appendFavIcon(B)
  3009. }if(C=="default"){return 
  3010. }}if(Klib.inArray(C.id,B.linkscent.current)){return 
  3011. }if(Klib.Pref.get("LinkScent.maxIconsPerLink")&&(B.linkscent.iconcount>Klib.Pref.get("LinkScent.maxIconsPerLink"))){return 
  3012. }else{var A=Klib.LinkScent.createIcon(B);
  3013. A.setAttribute("clueid",C.id);
  3014. if(C.linkscentTooltip){A.title=C.generateLinkscentTooltip(B)
  3015. }var D="";
  3016. if(C.sprite&&B.linkscent.useTinyIcons){Klib.sprites[C.sprite+"Tiny"].setImg(A)
  3017. }else{if(C.sprite){Klib.sprites[C.sprite].setImg(A)
  3018. }else{A.src=C.localUrl+"/"+C.icon
  3019. }}Klib.LinkScent.insertIcon(B,A);
  3020. B.linkscent.current.push(C.id);
  3021. B.ownerDocument.linkscent.iconcount++
  3022. }};
  3023. Klib.LinkScent.cleanupLink=function(B){if(B.linkscent){if(B.linkscent.icons){for(var A=B.linkscent.icons.length-1;
  3024. A>=0;
  3025. A--){Klib.removeEle(B.linkscent.icons[A])
  3026. }}Klib.removeEvent(B,"mouseover",Klib.LinkScent.repositionIcons);
  3027. Klib.restoreStyle(B,"cursor");
  3028. B.linkscent=null
  3029. }};
  3030. Klib.LinkScent.cleanupDoc=function(C){if(C.linkscent){C.linkscent=null;
  3031. var A=C.getElementsByTagName("a");
  3032. for(var B=A.length-1;
  3033. B>=0;
  3034. B--){Klib.LinkScent.cleanupLink(A[B])
  3035. }Klib.removeEvent(C,"mousemove",Klib.LinkScent.handleDocMouseMove);
  3036. Klib.removeEvent(Klib.getWin(C),"mousewheel",Klib.LinkScent.handleDocMouseWheel)
  3037. }};
  3038. Klib.LinkScent.cleanupCurrentDoc=function(){if(Klib.ClueBridge.lastDoc){Klib.LinkScent.cleanupDoc(Klib.ClueBridge.lastDoc)
  3039. }};
  3040. Klib.htmlLength=function(A,B){A=A.replace(/ (;)?/ig," ");
  3041. A=A.replace(/&[#\w]+(;)?/ig,"-");
  3042. A=A.replace(/\s+/ig,(B?"":" "));
  3043. return A.length
  3044. };
  3045. Klib.LinkScent.visibleText=function(C,B){var A=Klib.Html.clean(C.innerHTML);
  3046. A=Klib.Html.removeFormElements(A);
  3047. if(B){A=Klib.Html.removeBlockTags(A,B)
  3048. }var D=Klib.Html.stripTags(A);
  3049. D=D.replace(/ (;)?/ig,"");
  3050. D=D.replace(/\s+/g,"");
  3051. D=D.replace(/&[#\w]+(;)?/ig,"-");
  3052. return D
  3053. };
  3054. Klib.LinkScent.linkedTextRatio=function(D){var B=Klib.LinkScent.visibleText(D);
  3055. if(!B){return 0
  3056. }var A=Klib.LinkScent.visibleText(D,"a");
  3057. var C=(B.length-A.length)/B.length;
  3058. C=Klib.limit(C,0,1);
  3059. return C
  3060. };
  3061. Klib.LinkScent.isTargetedLink=function(A){if(A.linkscent.isTargetedLink===undefined){if(A&&A.target&&(A.target.indexOf("_")!=0)){var D=A.target;
  3062. var C=Klib.getDoc(A);
  3063. var B=Klib.getWin(C);
  3064. if(C.getElementById(D)){A.linkscent.isTargetedLink=true
  3065. }else{if(C.getElementsByName(D).length){A.linkscent.isTargetedLink=true
  3066. }else{if(B&&B.frames&&B.frames[D]){A.linkscent.isTargetedLink=true
  3067. }else{if(B&&B.top&&B.top.frames&&B.top.frames[D]){A.linkscent.isTargetedLink=true
  3068. }}}}}A.linkscent.isTargetedLink=A.linkscent.isTargetedLink||false
  3069. }return A.linkscent.isTargetedLink
  3070. };
  3071. Klib.LinkScent.isInternalLink=function(B){if(B.linkscent&&B.linkscent.isInternalLink!==undefined){return B.linkscent.isInternalLink
  3072. }else{var A=Klib.getUrlFromLink(B);
  3073. var D=Klib.getUrl(B.ownerDocument.URL);
  3074. var C=(A.protocol==D.protocol&&A.basedomain==D.basedomain);
  3075. if(B.linkscent){B.linkscent.isInternalLink=C
  3076. }return C
  3077. }};
  3078. Klib.LinkScent.registerFileType=function(A,B){Klib.LinkScent.fileTypes[A]=B
  3079. };
  3080. Klib.LinkScent.avgWordsPerLink=function(H){var C=H.getElementsByTagName("a");
  3081. var G=0;
  3082. var D=0;
  3083. for(var E=0;
  3084. E<C.length;
  3085. E++){var F=C[E];
  3086. if(F&&F.href){var B=Klib.wordCount(Klib.innerText(F,true));
  3087. if(B){G++;
  3088. D+=B
  3089. }}}var A=(G>0)?(D/G):0;
  3090. return A
  3091. };
  3092. Klib.LinkScent.isInternalNavigationLink=function(I){var A=3;
  3093. var H="table,td,th,div,ul";
  3094. var G=24000;
  3095. if(I.linkscent.isInternalNavigationLink===undefined){var F="";
  3096. I.linkscent.isInternalNavigationLink=false;
  3097. var B=Klib.getFixedHref(I);
  3098. if((B.indexOf("#")>-1)&&(B.replace(/#.*$/,"")==I.ownerDocument.URL.replace(/#.*$/,""))){F="#anchored link";
  3099. I.linkscent.isInternalNavigationLink=false
  3100. }else{if(I.linkscent.linkType==Klib.LinkScent.LINK_TYPE_INTERNAL){var C=Klib.innerText(I,true);
  3101. if(Klib.wordCount(C)<=Klib.Pref.get("InternalNavigationLinks.maxWords",4)){var J=Klib.htmlLength(C);
  3102. var E=Klib.getParent(I,H);
  3103. if(E){var D=false;
  3104. while(!D){if(E.isInternalNavigationBlock!==undefined){D=true
  3105. }else{if(E.getElementsByTagName("a").length>=A){D=true
  3106. }else{if(!E.parentNode){D=true
  3107. }else{E=E.parentNode
  3108. }}}}if(D){if(E.isInternalNavigationBlock===undefined){if(E.innerHTML&&E.innerHTML.length>G){F="too much ("+E.innerHTML.length+") html in container";
  3109. E.isInternalNavigationBlock=false
  3110. }else{if(Klib.LinkScent.avgWordsPerLink(E)>Klib.Pref.getFloat("InternalNavigationLinks.maxWordsPerLink",3.5)){F="avgWordsPerLink > maxWordsPerLink";
  3111. E.isInternalNavigationBlock=false
  3112. }else{E.isInternalNavigationBlock=(Klib.LinkScent.linkedTextRatio(E)>=Klib.Pref.get("InternalNavigationLinks.linkedTextRatio",0.7))
  3113. }}}}else{F="couldn't find container";
  3114. E.isInternalNavigationBlock=false
  3115. }F=F||("isInternalNavigationBlock = "+E.isInternalNavigationBlock);
  3116. I.linkscent.isInternalNavigationLink=E.isInternalNavigationBlock
  3117. }}else{F="more than "+Klib.Pref.get("InternalNavigationLinks.maxWords",4)+"words"
  3118. }}}}return I.linkscent.isInternalNavigationLink
  3119. };
  3120. Klib.GEvent.addEvent("login",Klib.LinkScent.startRepositionVisibleIconsTimer);
  3121. Klib.GEvent.addEvent("logout",Klib.LinkScent.stopRepositionVisibleIconsTimer)
  3122. }if(Klib.install("LinkCursor",0.1)){Klib.LinkCursor.initDoc=function(B){var A=Klib.getWin(B);
  3123. Klib.addEvent(A,"mouseout",Klib.LinkCursor.handleMouseOut);
  3124. B.interclue=B.interclue||{};
  3125. B.interclue.linkCursorVisible=false;
  3126. B.interclue.linkCursorLink=null
  3127. };
  3128. Klib.LinkCursor.cleanupDoc=function(B){var A=Klib.getWin(B);
  3129. Klib.removeEvent(A,"mouseout",Klib.LinkCursor.handleMouseOut);
  3130. if(B.interclue){B.interclue.linkCursorVisible=false;
  3131. B.interclue.linkCursorLink=null;
  3132. if(B.interclue.linkCursor){Klib.removeEle(B.interclue.linkCursor);
  3133. B.interclue.linkCursor=null
  3134. }}};
  3135. Klib.LinkCursor.handleMouseOut=function(A){if(!A.relatedTarget&&!A.toElement){Klib.LinkCursor.hide(A.doc)
  3136. }};
  3137. Klib.LinkCursor.showClue=function(A){var B=A.source;
  3138. if(B&&B.interclue&&B.interclue.currLink){var C=B.interclue.currLink;
  3139. Klib.LinkScent.setupLink(C);
  3140. Klib.ClueFrame.showClue(C,true)
  3141. }};
  3142. Klib.LinkCursor.getCursor=function(C){if(!C.interclue.linkCursor){var B=C.createElement("img");
  3143. var D=Klib.Pref.get("LinkScent.navigationalMode");
  3144. if(D=="tinyicon"){Klib.setCSS(B,Klib.getStyles("interclue-linkcursor-tiny"));
  3145. Klib.addEvent(B,"mouseover",Klib.LinkCursor.stopHideTimer);
  3146. Klib.addEvent(B,"mouseout",Klib.LinkCursor.startHideTimer);
  3147. Klib.addEvent(B,"click",Klib.LinkCursor.showClue);
  3148. Klib.Hover.addHover(B,Klib.LinkCursor.showClue,Klib.Pref.get("LinkScent.hoverDelay"))
  3149. }else{Klib.setCSS(B,Klib.getStyles("interclue-linkcursor"))
  3150. }B.interclue={};
  3151. B.interclue.cursorId="";
  3152. var A=Klib.LinkScent.getInterclueBox(C);
  3153. A.appendChild(B);
  3154. C.interclue.linkCursor=B
  3155. }return C.interclue.linkCursor
  3156. };
  3157. Klib.LinkCursor.showTinyIconHint=function(A){};
  3158. Klib.LinkCursor.stopHideTimer=function(A){Klib.clearTimer("Klib.LinkCursor.hide")
  3159. };
  3160. Klib.LinkCursor.startHideTimer=function(A){var B=A.doc||A;
  3161. Klib.setNamedTimer("Klib.LinkCursor.hide",function(){Klib.LinkCursor.hideCursor(B)
  3162. },Klib.Pref.get("LinkScent.tiny.hideDelay"))
  3163. };
  3164. Klib.LinkCursor.applyCursor=function(A,B,D){A.linkscent.linkCursor=B;
  3165. if(D){var C=A.ownerDocument;
  3166. if(C.interclue&&C.interclue.mouseOverLink==A&&Klib.Mouse.currNode){Klib.LinkCursor.show(Klib.Mouse,A)
  3167. }}};
  3168. Klib.LinkCursor.handleMouseMove=function(A,C){var D=A.doc;
  3169. if(D){if(Klib.Security.isDocEnabled(D)){D.interclue=D.interclue||{};
  3170. D.interclue.mouseOverLink=C||null;
  3171. if(C&&C.linkscent&&C.linkscent.linkCursor){Klib.LinkCursor.show(A,C)
  3172. }else{if(D.interclue.linkCursorVisible){var B=Klib.getParent(A.currTarget,"img",true);
  3173. if(!B||B!=D.interclue.linkCursor){Klib.LinkCursor.hide(A.doc)
  3174. }}}}}};
  3175. Klib.LinkCursor.checkPosition=function(C,H,G){var B=16;
  3176. var D=16;
  3177. var F=Klib.getWin(G);
  3178. var E=F.innerWidth+F.scrollMaxX;
  3179. var A=F.innerHeight+F.scrollMaxY;
  3180. if((C+B)>E){C=E-B
  3181. }if(C<0){C=0
  3182. }if((H+D)>A){H=A-D
  3183. }if(H<0){H=0
  3184. }return{x:C,y:H}
  3185. };
  3186. Klib.LinkCursor.show=function(A,B){if(A.doc&&!Klib.ClueFrame.isClueFrameDoc(A.doc)&&Klib.hasWin(A.doc)){switch(Klib.Pref.get("LinkScent.navigationalMode")){case"cursor":Klib.LinkCursor.showCursor(A,B);
  3187. break;
  3188. case"tinyicon":Klib.LinkCursor.showTinyIcon(B);
  3189. break;
  3190. case"none":return ;
  3191. default:throw Error("Interclue: Invalid pref: LinkScent.navigationalMode:"+Klib.Pref.get("LinkScent.navigationalMode"))
  3192. }}};
  3193. Klib.LinkCursor.showTinyIcon=function(E){var G=E.ownerDocument;
  3194. var D=10;
  3195. if(G.interclue.linkCursorLink!=E){G.interclue.linkCursorLink=E;
  3196. var F=E.linkscent.linkCursor;
  3197. var C=Klib.LinkCursor.getCursor(G);
  3198. C.interclue.currLink=E;
  3199. if(C.interclue.cursorId!=F){if(Klib.sprites[F+"Tiny"]){Klib.sprites[F+"Tiny"].setImg(C)
  3200. }else{throw Error("Interclue: tiny sprite missing for "+F)
  3201. }C.interclue.cursorId=F
  3202. }var B=Klib.LinkScent.calculateEndOfText(E);
  3203. var A=B.left+Klib.Pref.get("LinkScent.tiny.offsetX");
  3204. var H=(B.top+B.height)+Klib.Pref.get("LinkScent.tiny.offsetY")-D;
  3205. Klib.setStyle(C,"left",A+"px");
  3206. Klib.setStyle(C,"top",H+"px");
  3207. Klib.setStyle(C,"display","block");
  3208. G.interclue.linkCursorVisible=true
  3209. }};
  3210. Klib.LinkCursor.showCursor=function(B,D){var E=D.linkscent.linkCursor;
  3211. var C=Klib.LinkCursor.getCursor(B.doc);
  3212. if(C.interclue.cursorId!=E){Klib.sprites[E].setImg(C);
  3213. C.interclue.cursorId=E
  3214. }var G=Klib.LinkScent.getBodyScreenPosition(B.doc);
  3215. if(!G){return 
  3216. }var A=(B.screenX-G.screenX)+Klib.Pref.get("LinkCursor.offsetX");
  3217. var H=(B.screenY-G.screenY)+Klib.Pref.get("LinkCursor.offsetY");
  3218. var F=Klib.LinkCursor.checkPosition(A,H,B.doc);
  3219. Klib.setStyle(C,"left",F.x+"px");
  3220. Klib.setStyle(C,"top",F.y+"px");
  3221. Klib.setStyle(C,"display","block");
  3222. B.doc.interclue.linkCursorVisible=true
  3223. };
  3224. Klib.LinkCursor.hideCursor=function(A){Klib.setStyle(A.interclue.linkCursor,"display","none");
  3225. A.interclue.linkCursorLink=null;
  3226. A.interclue.linkCursorVisible=false
  3227. };
  3228. Klib.LinkCursor.hide=function(A){if(A.interclue&&A.interclue.linkCursor){var B=Klib.Pref.get("LinkScent.navigationalMode");
  3229. if(B=="cursor"){Klib.LinkCursor.hideCursor(A)
  3230. }else{if(B=="tinyicon"){Klib.LinkCursor.startHideTimer(A)
  3231. }}}}
  3232. }Klib.Button=function(A){var C=this;
  3233. C.id="";
  3234. C.tooltip="";
  3235. C.disabled=false;
  3236. C.classname="klib-button";
  3237. C.state="normal";
  3238. C.onclick=function(){};
  3239. C.ondblclick=function(){};
  3240. C.hidden=false;
  3241. C.locked=false;
  3242. C.buttonCSS={};
  3243. C.imageCSS={};
  3244. C.origDisplay="";
  3245. C.enabled=function(){return true
  3246. };
  3247. for(var B in A){C[B]=A[B]
  3248. }C.sprite=C.sprite?Klib.sprites[C.sprite]:null;
  3249. C.spriteDisabled=C.spriteDisabled?Klib.sprites[C.spriteDisabled]:null;
  3250. C.getClass=function(D){return C.baseClassName+"-"+D
  3251. };
  3252. C.getClasses=function(){return[C.baseClassName+"-normal",C.baseClassName+"-hover",C.baseClassName+"-toggled",C.baseClassName+"-disabled"]
  3253. };
  3254. C.appendTo=function(D){var E=D.ownerDocument;
  3255. C.button=E.createElement("span");
  3256. C.button.setAttribute("id",C.id);
  3257. C.button.setAttribute("title",C.tooltip);
  3258. C.button.className=C.baseClassName+" "+C.getClass("normal");
  3259. Klib.setCSS(C.button,C.buttonCSS);
  3260. C.origDisplay=(C.buttonCSS.display)?C.buttonCSS.display:C.origDisplay;
  3261. if(C.hidden){Klib.setStyle(C.button,"display","none")
  3262. }else{Klib.setStyle(C.button,"display",C.origDisplay)
  3263. }C.img=C.sprite.createImg(C.button);
  3264. Klib.setCSS(C.img,C.imageCSS);
  3265. D.appendChild(C.button);
  3266. Klib.addEvent(C.button,"click",C.handleClick);
  3267. Klib.addEvent(C.button,"dblclick",C.handleDblClick)
  3268. };
  3269. C.setState=function(D){C.state=D;
  3270. C.disabled=(D=="disabled");
  3271. C.redraw()
  3272. };
  3273. C.redraw=function(){Klib.replaceClass(C.button,C.getClasses(),C.getClass(C.state));
  3274. switch(C.state){case"normal":case"hover":case"toggled":C.sprite.setImg(C.img);
  3275. Klib.setStyle(C.button,"display",C.origDisplay);
  3276. break;
  3277. case"disabled":C.spriteDisabled.setImg(C.img);
  3278. Klib.setStyle(C.button,"display",C.origDisplay);
  3279. break;
  3280. case"hidden":Klib.setStyle(C.button,"display","none");
  3281. break;
  3282. default:throw Error("Unknown Klib.Button state ["+C.state+"]")
  3283. }};
  3284. C.disable=function(){C.setState("disabled")
  3285. };
  3286. C.enable=function(){C.setState("normal")
  3287. };
  3288. C.hide=function(){C.setState("hidden")
  3289. };
  3290. C.handleClick=function(D){if(!C.disabled){C.onclick(D)
  3291. }};
  3292. C.handleDblClick=function(D){if(!C.disabled){C.ondblclick(D)
  3293. }}
  3294. };
  3295. if(Klib.install("Clue",0.1)){Klib.Clue.STATE_LOADING=0;
  3296. Klib.Clue.STATE_LOADED=1;
  3297. Klib.Clue.STATE_RETRIEVING=2;
  3298. Klib.Clue.STATE_PARSING=3;
  3299. Klib.Clue.STATE_COMPLETE=4;
  3300. Klib.Clue.STATE_ERROR=-1;
  3301. Klib.Clue.current=[];
  3302. Klib.Clue.installed=[];
  3303. Klib.Clue.currentDoc=null;
  3304. Klib.Clue.currentLocation="";
  3305. Klib.Clue.currentURL={};
  3306. Klib.Clue.currentClue=null;
  3307. Klib.Clue.currVisibleClueEle=null;
  3308. Klib.Clue.currentEle=null;
  3309. Klib.Clue.lastSelectedClue="";
  3310. Klib.Clue.lastClue=null;
  3311. Klib.Clue.hoverLink=null;
  3312. Klib.Clue.cache=new Klib.Cache.Obj("Clue");
  3313. Klib.Clue.cacheHtml=new Klib.Cache.Obj("cacheHTML");
  3314. Klib.Clue.rules=[];
  3315. Klib.Clue.regexPrivateUrls=null;
  3316. Klib.Clue.initContentDoc=function(D,C){var F=Klib.getEles("img.metadata-hide-button, img.metadata-close-button",D);
  3317. var E=C.cacheId();
  3318. for(var B=0;
  3319. B<F.length;
  3320. B++){var A=F[B];
  3321. A.setAttribute("cluecacheid",E);
  3322. if(Klib.hasClass(A,"metadata-hide-button")){Klib.addEvent(A,"click",function(){Klib.Clue.cache.remove(E)
  3323. })
  3324. }}};
  3325. Klib.Clue.getLinkSubstitutions=function(B){var A={};
  3326. A.innerHTML=B.innerHTML;
  3327. A.innerText=Klib.innerText(B);
  3328. A.location=encodeURIComponent(B.ownerDocument.URL);
  3329. A.plainLocation=B.ownerDocument.URL;
  3330. A.url=encodeURIComponent(Klib.getFixedHref(B));
  3331. A.plainUrl=Klib.getFixedHref(B);
  3332. A.plainPage=Klib.getFixedHref(B).replace(/#.*$/,"");
  3333. A.filename=B.linkscent.filename?B.linkscent.filename:null;
  3334. try{A.domain=encodeURIComponent(B.hostname);
  3335. A.plainDomain=B.hostname
  3336. }catch(C){A.domain="";
  3337. A.plainDomain=""
  3338. }return A
  3339. };
  3340. Klib.Clue.copyToClipboard=function(A){var B=Klib.Clue.getClueText(A,true);
  3341. if(Klib.ClueBridge.copyToClipboard(B)){Klib.ClueFrame.alert(Klib.string("clipboard.copy.succeeded"),Klib.string("clipboard.success.title"),"",1000)
  3342. }else{Klib.ClueFrame.alert(Klib.string("clipboard.copy.failed"),Klib.string("clipboard.error.title"),"error")
  3343. }};
  3344. Klib.Clue.getClueText=function(E,G){var D=Klib.ClueFrame.contentFrame.doc;
  3345. var B=Klib.getSelectedHtml(D);
  3346. if(!B&&$("content",D)){B=$("content",D).innerHTML
  3347. }else{if(!B){B=D.body.innerHTML
  3348. }}var A="";
  3349. if(E.link&&G){A="This is a summary of content from: "+Klib.getFixedHref(E.link)+"\n";
  3350. var C=E.link.ownerDocument.URL;
  3351. if(E.link.href!=C){A+="The link to this content was from: "+C+"\n"
  3352. }var F=new Date();
  3353. A+="Summary created on: "+F.toLocaleString()+"\n";
  3354. A+="The summary was created by Interclue: http://interclue.com\n";
  3355. A+="----------------------------------------------------------\n\n"
  3356. }return A+Klib.Html.toText(B)
  3357. };
  3358. Klib.Clue.copyLinkUrlToClipboard=function(B){var A=Klib.ClueFrame.getCurrentURL();
  3359. if(A&&Klib.ClueBridge.copyToClipboard(A)){Klib.ClueFrame.alert(Klib.string("clipboard.copy.succeeded"),Klib.string("clipboard.success.title"),"",1000)
  3360. }else{Klib.ClueFrame.alert(Klib.string("clipboard.copy.failed"),Klib.string("clipboard.error.title"),"error")
  3361. }};
  3362. Klib.Clue.handleMouseWheel=function(A){Klib.Stats.userActive=true;
  3363. Klib.setNamedTimer("clueStatsActive",Klib.Stats.timerActive,Klib.Pref.get("User.activeTimeout",5)*1000)
  3364. };
  3365. Klib.Clue.stateStr=function(A){switch(A){case Klib.Clue.STATE_LOADING:return"loading...";
  3366. case Klib.Clue.STATE_LOADED:return"loaded";
  3367. case Klib.Clue.STATE_RETRIEVING:return"retrieving content...";
  3368. case Klib.Clue.STATE_PARSING:return"parsing content...";
  3369. case Klib.Clue.STATE_COMPLETE:return"complete";
  3370. case Klib.Clue.STATE_ERROR:return"error";
  3371. default:Klib.error(Error("Klib.Clue.stateStr Invalid state variable"),A);
  3372. break
  3373. }return false
  3374. };
  3375. Klib.Clue.setEventPosition=function(A){Klib.Clue.screenX=A.screenX;
  3376. Klib.Clue.screenY=A.screenY;
  3377. Klib.Clue.docX=A.docX;
  3378. Klib.Clue.docY=A.docY
  3379. };
  3380. Klib.Clue.handleLinkScentClick=function(A){Klib.Clue.hoverLink=Klib.LinkScent.findLinkFromEvent(A);
  3381. Klib.Clue.setEventPosition(A);
  3382. Klib.Clue.showClues("handleLinkScentClick")
  3383. };
  3384. Klib.Clue.activateHotKeyAutolock=function(){var A=Klib.ClueFrame.getIframe();
  3385. if(A&&Klib.ClueFrame.visible&&!A.locked){Klib.ClueFrame.toggleLocked()
  3386. }};
  3387. Klib.Clue.handleHotKeys=function(A){if(!Klib.Drag.dragging){Klib.Clue.hotKeysPressed=true;
  3388. var B=Klib.ClueFrame.getIframe();
  3389. if(B&&Klib.ClueFrame.visible&&B.locked){Klib.ClueFrame.toggleLocked(false);
  3390. Klib.ClueFrame.hide(true)
  3391. }else{if(B&&Klib.ClueFrame.visible&&!B.locked){Klib.ClueFrame.toggleLocked()
  3392. }else{if(Klib.LinkScent.currentLink){if(Klib.Clue.hoverLink!=Klib.LinkScent.currentLink){Klib.Clue.hoverLink=Klib.LinkScent.currentLink;
  3393. Klib.LinkScent.showCurrentLinksLinkscents(true)
  3394. }Klib.Clue.setEventPosition(Klib.Mouse);
  3395. Klib.Clue.showClues("handleHotKeys")
  3396. }}}Klib.Clue.hotKeysPressed=false
  3397. }};
  3398. Klib.Clue.fireHotKeyOff=function(A){};
  3399. Klib.Clue.docAllowsClues=function(B){if(!B){return false
  3400. }if(B.disableClues){return false
  3401. }if(B.defaultView&&B.defaultView.disableClues){return false
  3402. }if(!Klib.ClueBridge.isValidDocument(B)){return false
  3403. }var C=B.getElementsByTagName("meta");
  3404. for(var A=0;
  3405. A<C.length;
  3406. A++){if((C[A].getAttribute("name")=="interclue")&&(C[A].getAttribute("content")=="disabled")){B.disableClues=true;
  3407. return false
  3408. }}return true
  3409. };
  3410. Klib.Clue.handleLogout=function(){Klib.Clue.currentDoc=null;
  3411. Klib.Clue.currentLocation="";
  3412. Klib.Clue.currentClue=null;
  3413. Klib.Clue.currentEle=null;
  3414. Klib.Clue.lastSelectedClue="";
  3415. Klib.Clue.hoverLink=null;
  3416. Klib.Key.removeEvent(Klib.Pref.get("ClueFrame.hotKey"),Klib.Clue.handleHotKeys);
  3417. Klib.Key.removeEvent(Klib.Pref.get("PresentationMode.prevLinkKey"),Klib.ClueFrame.showLinkPrev);
  3418. Klib.Key.removeEvent(Klib.Pref.get("PresentationMode.nextLinkKey"),Klib.ClueFrame.showLinkNext);
  3419. Klib.Key.removeEvent(Klib.Pref.get("PresentationMode.prevSimilarLinkKey"),Klib.ClueFrame.showLinkPrevSimilar);
  3420. Klib.Key.removeEvent(Klib.Pref.get("PresentationMode.nextSimilarLinkKey"),Klib.ClueFrame.showLinkNextSimilar)
  3421. };
  3422. Klib.Clue.getCurrentShowEvent=function(){var A=Klib.ClueFrame.getIframe();
  3423. return(A&&A.locked)?Klib.Pref.get("ClueFrame.lockedShowEvent"):Klib.Pref.get("ClueFrame.showEvent")
  3424. };
  3425. Klib.Clue.handleLinkScentHover=function(A){var B=Klib.getParent(A.currTarget,"img",true);
  3426. var C=null;
  3427. if(B&&B.getAttribute("interclue_link_href")){C=Klib.LinkScent.findLinkByUrl(B.ownerDocument,B.getAttribute("interclue_link_href"),B.getAttribute("interclue_link_index"))
  3428. }else{if(B&&B.linkscent&&B.linkscent.link){C=B.linkscent.link
  3429. }}if(C){Klib.Clue.hoverLink=C;
  3430. if(C.linkscent&&C.linkscent.useTinyIcons&&Klib.Pref.get("Clue.requireClickToClueLinksWithTinyIcons")){B.setAttribute("title",Klib.getString("linkscent.requires.click.to.clueview"));
  3431. return 
  3432. }if(Klib.Clue.getCurrentShowEvent()=="hover"&&!Klib.LinkScent.isScriptLink(C)){Klib.Clue.setEventPosition(A);
  3433. Klib.Clue.showClues("hover-linkscent")
  3434. }}};
  3435. Klib.Clue.handleLinkHover=function(A){var B=Klib.LinkScent.findLinkFromEvent(A);
  3436. Klib.Clue.hoverLink=B;
  3437. if(B&&Klib.Clue.getCurrentShowEvent()=="linkhover"){Klib.Clue.setEventPosition(A);
  3438. Klib.Clue.showClues("hover-link")
  3439. }};
  3440. Klib.Clue.initLink=function(A,B){if(B||!A.clue){A.clue={};
  3441. if(Klib.Pref.get("Summary.sendPrefetchRequest")){Klib.Summary.initLink(A)
  3442. }}};
  3443. Klib.Clue.cleanupLink=function(A){if(A){Klib.Summary.cleanupLink(A);
  3444. A.clue=null
  3445. }};
  3446. Klib.Clue.getClue=function(B){for(var A=0;
  3447. A<Klib.Clue.current.length;
  3448. A++){if(Klib.Clue.current[A].id==B){return Klib.Clue.current[A]
  3449. }}return null
  3450. };
  3451. Klib.Clue.linkHasClues=function(B){if(B.linkscent.linkHasClues===undefined){B.linkscent.linkHasClues=false;
  3452. for(var A=0;
  3453. A<Klib.Clue.current.length;
  3454. A++){var C=Klib.Clue.current[A];
  3455. if(C.enabled&&(C.id!="about")&&(!C.linkscentOnly)&&C.isValidLink(B)){B.linkscent.linkHasClues=true;
  3456. break
  3457. }}}return B.linkscent.linkHasClues
  3458. };
  3459. Klib.Clue.showClues=function(A){if(Klib.Clue.hoverLink&&Klib.Clue.hoverLink.linkscent&&Klib.Clue.hoverLink.linkscent.allowClueFrame&&Klib.Clue.linkHasClues(Klib.Clue.hoverLink)){if(!Klib.Clue.hoverLink.linkscent.disableClues){Klib.Clue.currentEle=Klib.Clue.hoverLink;
  3460. Klib.Clue.show();
  3461. Klib.LinkScent.fadeDocLinkscents(Klib.Clue.hoverLink.ownerDocument)
  3462. }else{Klib.warning("Wont show clues, link.linkscent.disableClues = "+Klib.Clue.hoverLink.linkscent.disableClues)
  3463. }}else{}};
  3464. Klib.Clue.initPrivateUrls=function(A){if(A||!Klib.Clue.regexPrivateUrls){Klib.Clue.regexPrivateUrls=Klib.KRegex.toRegexArr(Klib.Pref.get("Privacy.privateUrls","").split(/[\,\s]+/g))
  3465. }return Klib.Clue.regexPrivateUrls
  3466. };
  3467. Klib.Clue.isPrivateUrl=function(A){Klib.Clue.initPrivateUrls();
  3468. for(var B=0;
  3469. B<Klib.Clue.regexPrivateUrls.length;
  3470. B++){if(Klib.Clue.regexPrivateUrls[B].regex.test(A)){return true
  3471. }}return false
  3472. };
  3473. Klib.Clue.matchPrivateUrl=function(A){var C=[];
  3474. Klib.Clue.initPrivateUrls();
  3475. for(var B=0;
  3476. B<Klib.Clue.regexPrivateUrls.length;
  3477. B++){if(Klib.Clue.regexPrivateUrls[B].regex.test(A)){C.push(Klib.Clue.regexPrivateUrls[B].strExp)
  3478. }}return C
  3479. };
  3480. Klib.Clue.prefetchExternalPages=function(F){if(F&&F.links){var G=[];
  3481. var C=Klib.Pref.get("Clue.prefetchExternalPages",0);
  3482. for(var D=0;
  3483. D<F.links.length;
  3484. D++){var E=F.links[D];
  3485. var B=Klib.getFixedHref(E);
  3486. if(B&&B.match(/^http:/i)&&!Klib.LinkScent.isInternalLink(E)&&Klib.LinkScent.shouldPrefetchLink(E)&&!Klib.inArray(G,B)){G.push(B);
  3487. if(G.length>=C){break
  3488. }}}for(var D=0;
  3489. D<G.length;
  3490. D++){var B=G[D];
  3491. var A=new Klib.HTMLDoc.Obj(B);
  3492. A.fetchHead=Klib.Pref.get("Clue.prefetchHead",true);
  3493. A.maxContentLength=Klib.Pref.get("Clue.maxContentLength")*1024;
  3494. A.parseHTML=Klib.Pref.get("Clue.prefetchParseHTML");
  3495. if(Klib.Pref.get("Privacy.addXClueHeaders",true)){A.requestHeaders["X-clue"]="prefetch"
  3496. }if(Klib.Url.isPayPerClickUrl(B)){A.requestHeaders["x-moz"]="prefetch"
  3497. }A.fetch()
  3498. }}else{Klib.warning("prefetchExternalPages : document has no links")
  3499. }};
  3500. Klib.Clue.refresh=function(){Klib.Clue.show(true)
  3501. };
  3502. Klib.Clue.show=function(F,B,A){if(Klib.Pref.get("Clues.enabled")){B=B||Klib.Clue.hotKeysPressed;
  3503. if(Klib.Clue.currentEle){if((Klib.Clue.currVisibleClueEle==Klib.Clue.currentEle)&&!F){return 
  3504. }var D=Klib.Clue.currentEle;
  3505. var E=true;
  3506. if(D.linkscent.precaching){E=Klib.Pref.get("ClueFrame.showProcessing")
  3507. }else{if(D.linkscent.isSafe&&!D.linkscent.precached&&Klib.LinkScent.shouldPrefetchLink(D)){Klib.LinkScent.fetchLink(D,true);
  3508. E=Klib.Pref.get("ClueFrame.showProcessing")
  3509. }else{if(!D.linkscent.allowClueFrame){return 
  3510. }}}if(E&&Klib.ClueFrame.checkFrame(Klib.Clue.currentEle)){if(Klib.Clue.currentEle){Klib.Tutorial.fireEvent(Klib.Clue.currentEle,"clueframeshow");
  3511. Klib.ClueFrame.resetSize();
  3512. var C=Klib.ClueFrame.getIframe();
  3513. if(!C){if(Klib.isFrameset(Klib.getWin(Klib.Clue.currentEle.ownerDocument).top.document)){top.interclue.Tooltip.show(Klib.getString("warning.frameset.unable.to.find.clueframe"));
  3514. return 
  3515. }}if(A){Klib.ClueFrame.positionFrame(D);
  3516. Klib.ClueFrame.show()
  3517. }if(C&&C.locked||C.dontReposition){}else{if(B){if(!Klib.ClueFrame.visible){Klib.ClueFrame.positionFrame(Klib.Clue.currentEle);
  3518. Klib.ClueFrame.show();
  3519. Klib.ClueFrame.toggleLocked(true)
  3520. }}else{if(Klib.ClueFrame.visible&&(C.currentLink==Klib.Clue.currentEle)){}else{Klib.ClueFrame.positionFrame()
  3521. }}}C.currentLink=Klib.Clue.currentEle;
  3522. C.currentURL=Klib.getFixedHref(Klib.Clue.currentEle);
  3523. Klib.ClueFrame.visible=true;
  3524. Klib.ClueFrame.showCurrentLink(F);
  3525. if(Klib.Pref.get("ClueFrame.frameType")=="window"&&Klib.isIE){Klib.ClueFrame.win.focus()
  3526. }}else{Klib.warning("Klib.Clue.show","no current link after build frame")
  3527. }}else{Klib.setNamedTimer("Klib.Clue.show",function(){Klib.Clue.show(F,B)
  3528. },100)
  3529. }}else{Klib.warning("Klib.Clue.show","no current link")
  3530. }}};
  3531. Klib.Clue.onNavigate=function(A){var C=(A.source&&A.source.document)?A.source.document:null;
  3532. var B=(A.eventData&&A.eventData.docUrl)?A.eventData.docUrl:"";
  3533. if(C&&(C.URL==B)){Klib.fireEvent(C,"unload",A);
  3534. Klib.Clue.currentEle=null
  3535. }Klib.ClueFrame.iframe=null;
  3536. if(Klib.platform=="IEToolbar"){Klib.documentIsUnloading=true
  3537. }};
  3538. Klib.Clue.handleUnload=function(A){var B=A.source;
  3539. if(B==Klib.ClueBridge.sourceDoc){Klib.Ajax.abortAll("htmldoc")
  3540. }};
  3541. Klib.Clue.initDoc=function(B){if(!B.clue){B.clue={};
  3542. B.clue.linkCount=0;
  3543. if(Klib.Pref.get("Clues.enabled")){Klib.Hover.addHover(B.body,Klib.Clue.handleLinkScentHover,Klib.Pref.getInt("ClueFrame.hoverDelay"));
  3544. Klib.Hover.addHover(B.body,Klib.Clue.handleLinkHover,Klib.Pref.getInt("ClueFrame.linkHoverDelay"));
  3545. Klib.addEvent(B,"click",Klib.ClueFrame.hide);
  3546. Klib.addEvent(B,"mousemove",Klib.ClueFrame.handleMouseOutFrame);
  3547. Klib.addEvent(B,"mouseover",Klib.ClueFrame.hideTooltip);
  3548. Klib.addEvent(B,"unload",Klib.Clue.handleUnload);
  3549. var A=Klib.getWin(B);
  3550. if(A){Klib.addEvent(A,"unload",Klib.Clue.onNavigate,{docUrl:B.URL});
  3551. Klib.addEvent(A,"mousewheel",Klib.Clue.handleMouseWheel)
  3552. }else{Klib.error("Unable to add handlers to window: window not found",B)
  3553. }}Klib.Tutorial.initDoc(B)
  3554. }Klib.Clue.hotKeysPressed=false;
  3555. Klib.Clue.currentDoc=B;
  3556. Klib.Clue.currentLocation=B.URL;
  3557. Klib.Clue.currentUrl=Klib.Url.parse(B.URL);
  3558. if(!B.getElementById("ClueFrame")){Klib.setTimer(Klib.Clue.backgroundBuildClueFrame,1000)
  3559. }};
  3560. Klib.Clue.backgroundBuildClueFrame=function(){try{if(Klib.ClueBridge.sourceDoc&&Klib.ClueBridge.sourceDoc.body&&!Klib.ClueBridge.sourceDoc.getElementById("ClueFrame")&&Klib.Clue.docAllowsClues(Klib.ClueBridge.sourceDoc)&&!Klib.isFrameset(Klib.ClueBridge.sourceDoc)&&(Klib.ClueBridge.sourceDoc.URL.match(/^http:/i))){Klib.ClueFrame.buildIFrame(Klib.ClueBridge.sourceDoc)
  3561. }}catch(A){Klib.error("Klib.Clue.backgroundBuildClueFrame",A)
  3562. }};
  3563. Klib.Clue.cleanupDoc=function(D){if(D.clue){var C=Klib.getWin(D);
  3564. Klib.removeEvent(C,"mousewheel",Klib.Clue.handleMouseWheel);
  3565. Klib.removeEvent(C,"beforeunload",Klib.Clue.onNavigate);
  3566. Klib.removeEvent(D,"click",Klib.ClueFrame.hide);
  3567. Klib.removeEvent(D,"mousemove",Klib.ClueFrame.handleMouseOutFrame);
  3568. Klib.removeEvent(D,"unload",Klib.Clue.handleUnload);
  3569. Klib.removeEvent(D,"mouseover",Klib.ClueFrame.hideTooltip);
  3570. var A=Klib.getEles("a",D);
  3571. if(A){for(var B=0;
  3572. B<A.length;
  3573. B++){Klib.Clue.cleanupLink(A[B])
  3574. }}D.clue=null
  3575. }};
  3576. Klib.Clue.checkEnabled=function(){for(var A=0;
  3577. A<Klib.Clue.current.length;
  3578. A++){var B=Klib.Clue.current[A];
  3579. B.enabled=Klib.Pref.get("Clue."+B.id+".enabled",true)
  3580. }};
  3581. Klib.Clue.install=function(B){var A=new Klib.Clue.Obj(B);
  3582. if(Klib.inArray(Klib.platform,A.platforms)&&A.shouldInstall()){A.enabled=Klib.Pref.get("Clue."+A.id+".enabled",true);
  3583. A.order=-1;
  3584. Klib.Clue.installed.push(A);
  3585. Klib.Clue.current.push(A)
  3586. }};
  3587. Klib.Clue.attemptInstall=function(A){if(!A.error){Klib.Clue.install(A.json)
  3588. }else{Klib.error("Failed to install cluescript",A.url,A.statusText)
  3589. }};
  3590. Klib.Clue.installClues=function(){var D=Klib.Pref.get("Clues.installed","").split(/\s*,\s*/g);
  3591. D=Klib.STATIC_CLUE_LIST;
  3592. for(var C=0;
  3593. C<D.length;
  3594. C++){var B=D[C];
  3595. var A=Klib.baseUrl+"/clues/"+B+"/"+B+".js";
  3596. Klib.Ajax.getJson(A,Klib.Clue.attemptInstall)
  3597. }};
  3598. Klib.Clue.sortFunc=function(B,A){if(B.order==-1){return 1
  3599. }if(A.order==-1){return -1
  3600. }return(B.order-A.order)
  3601. };
  3602. Klib.Clue.reorder=function(){var B=Klib.Pref.get("ClueFrame.clueOrder","").split(/,/g);
  3603. var D=[];
  3604. for(var A=0;
  3605. A<B.length;
  3606. A++){var C=Klib.Clue.getClue(B[A]);
  3607. if(C){C.order=A
  3608. }}Klib.Clue.current=Klib.Clue.current.sort(Klib.Clue.sortFunc);
  3609. Klib.Clue.reindex()
  3610. };
  3611. Klib.Clue.setCurrentClues=function(A){Klib.Clue.current=[];
  3612. for(var B=0;
  3613. B<Klib.Clue.installed.length;
  3614. B++){var C=Klib.Clue.installed[B];
  3615. if(Klib.inArray(C.id,A)){Klib.Clue.current.push(C)
  3616. }}};
  3617. Klib.Clue.handleLogin=function(){if(Klib.Clue.current.length==0){Klib.Clue.installClues()
  3618. }if(Klib.Pref.get("ClueFrame.hotKey.enabled")){Klib.Key.addEvent(Klib.Pref.get("ClueFrame.hotKey"),Klib.Clue.handleHotKeys)
  3619. }if(Klib.Pref.get("PresentationMode.enabled")){Klib.Key.addEvent(Klib.Pref.get("PresentationMode.prevLinkKey"),Klib.ClueFrame.showLinkPrev);
  3620. Klib.Key.addEvent(Klib.Pref.get("PresentationMode.nextLinkKey"),Klib.ClueFrame.showLinkNext);
  3621. Klib.Key.addEvent(Klib.Pref.get("PresentationMode.prevSimilarLinkKey"),Klib.ClueFrame.showLinkPrevSimilar);
  3622. Klib.Key.addEvent(Klib.Pref.get("PresentationMode.nextSimilarLinkKey"),Klib.ClueFrame.showLinkNextSimilar)
  3623. }};
  3624. Klib.Clue.isInternalLink=function(C){var A=Klib.getUrl(C.href);
  3625. var B=Klib.getUrl(C.ownerDocument.URL);
  3626. return(A.basedomain&&(A.basedomain==B.basedomain))
  3627. };
  3628. Klib.Clue.cluesAreUnavailable=function(){alert(Klib.string("linkscent.mode.description.unavailable"))
  3629. };
  3630. Klib.Clue.sendEmail=function(H){var E=2000;
  3631. var K=Klib.getProp(H,"link.linkscent.htmldoc.title",Klib.getFixedHref(H.link));
  3632. var J=Klib.strTruncate(K,100);
  3633. var I=Klib.string("email.disclaimer");
  3634. var F="\n----\n";
  3635. var M="mailto:?subject="+encodeURIComponent(J)+"&body="+encodeURIComponent(F+I);
  3636. var D=E-M.length;
  3637. var L=Klib.ClueFrame.contentFrame.doc;
  3638. var B=Klib.string("email.link.destination.url")+": "+Klib.getFixedHref(H.link)+"\n";
  3639. B+=Klib.string("email.link.location.url")+": "+H.link.ownerDocument.URL+"\n";
  3640. B+=F;
  3641. var C="";
  3642. if(Klib.getSelectedHtml(L)){C=Klib.getSelectedHtml(L)
  3643. }else{if($("content",L)){C=$("content",L).innerHTML
  3644. }else{C=L.body.innerHTML
  3645. }}B+=Klib.Html.toText(C);
  3646. var G=encodeURIComponent(B);
  3647. if(G.length>D){Klib.ClueBridge.copyToClipboard(B+F+I);
  3648. G=encodeURIComponent(_("clueframe.button.sendto.textCopiedToClipboard"))
  3649. }else{G+=encodeURIComponent(F+I)
  3650. }var A="mailto:?subject="+encodeURIComponent(J)+"&body="+G;
  3651. Klib.ClueBridge.openUrl(A);
  3652. Klib.ClueFrame.checkFrame(H.link)
  3653. };
  3654. Klib.Clue.reindex=function(){var D="";
  3655. var A=Klib.Clue.current.length;
  3656. for(var B=0;
  3657. B<Klib.Clue.current.length;
  3658. B++){var C=Klib.Clue.current[B];
  3659. C.order=B;
  3660. C.rank=(A-B);
  3661. D+=(D)?",":"";
  3662. D+=C.id
  3663. }Klib.Pref.set("ClueFrame.clueOrder",D)
  3664. };
  3665. Klib.Clue.Templates={};
  3666. Klib.Clue.Templates.clueContent='<html><head>    <title>{innerText}</title>    {defaultStylesheet}    <style type="text/css">{customcss}</style></head><body>   {clueInfoBlock}   {clueTitle}   <div id="interclue-header">{faviconlink} {pagetitle}</div><hr />   <div class="container">       {floatingbox}       <div class="interclue-content" id="content">{content}</div>       <div id="interclue-footer">{footer}</div>   </div>   <div id="interclue-tooltip-box" style="display: none;"></div></body></html>'
  3667. }if(Klib.install("Clue",0.1)){Klib.Clue.cluescriptVariableCache=new Klib.Cache.Obj("cluescriptVariable");
  3668. Klib.Clue.Obj=function(A,C){var D=this;
  3669. D.state=Klib.Clue.STATE_LOADING;
  3670. D.id=A.id;
  3671. D.nanoHint=A.nanoHint?Klib.cloneFunction(A.nanoHint):function(){return""
  3672. };
  3673. D.name=A.name||A.id;
  3674. D.group=A.group||"";
  3675. D.showFuzzyLinkclue=A.showFuzzyLinkclue||false;
  3676. D.rank=A.rank||0;
  3677. D.help=A.help||"";
  3678. D.QFS=A.QFS||false;
  3679. D.acceptXML=A.acceptXML||false;
  3680. D.localUrl=Klib.baseUrl+"/clues/"+D.id;
  3681. D.includeUrls=A.includeUrls||["http:*"];
  3682. D.excludeUrls=A.excludeUrls||[];
  3683. D.mimeTypes=A.mimeTypes||null;
  3684. D.maxContentLength=A.maxContentLength||0;
  3685. D.maxContentToParse=A.maxContentToParse||0;
  3686. D.refreshOnShow=A.refreshOnShow||false;
  3687. D.removeOnHide=A.removeOnHide||false;
  3688. D.redirects=[];
  3689. D.requestHeaders=A.requestHeaders||false;
  3690. D.httpUser=A.httpUser||"";
  3691. D.httpPass=A.httpPass||"";
  3692. D.externalContent=A.externalContent||false;
  3693. D.cursor=A.cursor||false;
  3694. D.textCursor=A.textCursor||false;
  3695. D.showFullContent=A.showFullContent||false;
  3696. if(A.linkscentTooltip){D.linkscentTooltip=(typeof A.linkscentTooltip=="function")?Klib.cloneFunction(A.linkscentTooltip):A.linkscentTooltip
  3697. }else{D.linkscentTooltip=""
  3698. }D.showLinkscentTooltipInClue=(A.showLinkscentTooltipInClue===undefined)?true:A.showLinkscentTooltipInClue;
  3699. D.templateVariables=A.templateVariables||false;
  3700. D.templateFile=A.templateFile||"";
  3701. D.templateHTML=A.templateHTML||Klib.Clue.Templates.clueContent;
  3702. D.hideLinkscentForInternalLinks=A.hideLinkscentForInternalLinks||false;
  3703. D.staticContent=A.staticContent||"";
  3704. D.framed=A.framed||false;
  3705. D.frameWidth=A.frameWidth||"100%";
  3706. D.frameHeight=A.frameHeight||"100%";
  3707. D.linkscentOnly=A.linkscentOnly||false;
  3708. D.icon=A.icon||"../defaultIcon.png";
  3709. D.sprite=A.sprite||"";
  3710. D.tinyIcon=A.tinyIcon||"../defaultTinyIcon.png";
  3711. D.iconUrl=D.localUrl+"/"+D.icon;
  3712. D.error="";
  3713. D.link=null;
  3714. D.onDisplayClue=A.onDisplayClue||null;
  3715. D.showActionButtons=(A.showActionButtons===undefined)?(D.group=="summary"):A.showActionButtons;
  3716. D.extractContentFailed=false;
  3717. D.linkscent=A.linkscent||"hide";
  3718. Klib.Pref.init("Clue.linkscent."+D.id+".visibility",D.linkscent);
  3719. D.contentUrl=A.contentUrl||"";
  3720. D.contentSafe=(A.contentSafe===undefined)?true:A.contentSafe;
  3721. D.contentUrlIsFrameset=false;
  3722. D.platforms=A.platforms||"firefox,siteclues,winclues,ietoolbar";
  3723. D.onLinkscentClick=Klib.cloneFunction(A.onLinkscentClick)||null;
  3724. if(typeof D.platforms=="string"){D.platforms=D.platforms.split(/,/)
  3725. }D.authorUrl="";
  3726. D.description=A.description||"";
  3727. D.retrieveEvent=A.retrieveEvent||"selectclue";
  3728. D.method="get";
  3729. D.sourceEle=C||null;
  3730. D.cache=(A.cache===undefined)?true:A.cache;
  3731. D.statusText="";
  3732. D.overrideSafeUrl=Klib.Pref.get("Clue."+D.id+".overrideSafeUrl",false);
  3733. D.visible=false;
  3734. D.debugging=A.debugging||false;
  3735. D.buttons=A.buttons||[];
  3736. D.state=Klib.Clue.STATE_LOADED;
  3737. D.isValid=A.isValid?Klib.cloneFunction(A.isValid):null;
  3738. D.initContent=A.initContent?Klib.cloneFunction(A.initContent):null;
  3739. D.initFramedContent=A.initFramedContent?Klib.cloneFunction(A.initFramedContent):null;
  3740. D.substitutes=false;
  3741. D.subs={};
  3742. D.headers={};
  3743. D.shouldInstall=A.shouldInstall?Klib.cloneFunction(A.shouldInstall):function(){return true
  3744. };
  3745. D.content="";
  3746. D.initSubstitutes=function(E){if(E){D.substitutes={};
  3747. for(var F in E){D.substitutes[F]=Klib.cloneFunction(E[F])
  3748. }}};
  3749. if(A.substitutes){D.initSubstitutes(A.substitutes)
  3750. }D.resetSubstitutes=function(F,G){D.subs={};
  3751. if(D.substitutes){for(var E in D.substitutes){D.subs[E]=D.substitutes[E](F,G)
  3752. }}D.subs.userId=Klib.Global.get("uid","");
  3753. D.subs.clueId=D.id;
  3754. D.subs.clueUrl=D.localUrl;
  3755. if(D.link&&D.link.href){D.subs=Klib.merge(D.subs,Klib.Clue.getLinkSubstitutions(D.link))
  3756. }};
  3757. D.resetSubstitutes();
  3758. D.setLink=function(F,G){if(F&&((D.link!=F)||(F.linkscent&&F.linkscent.forceRefresh)||G)){D.link=F;
  3759. D.location=F.ownerDocument.URL;
  3760. D.content="";
  3761. D.error="";
  3762. D.redirects=[];
  3763. D.resetSubstitutes(F,F.ownerDocument);
  3764. D.contentUrlIsFrameset=false;
  3765. D.authorInfoHTML="";
  3766. if(D.ajax&&D.ajax.abort){D.ajax.abort()
  3767. }D.extractContentFailed=false;
  3768. D.setState(Klib.Clue.STATE_LOADED);
  3769. F.linkscent.clueInfoBlock=D.clueInfoBlock();
  3770. if(D.cache&&D.contentUrl&&!F.linkscent.forceRefresh){var E=Klib.Clue.cache.get(D.cacheId());
  3771. if(E&&(E.clueId==D.id)){D.cached=true;
  3772. D.extractContentFailed=E.extractContentFailed;
  3773. D.content=E.content;
  3774. D.setState(Klib.Clue.STATE_COMPLETE)
  3775. }}}};
  3776. D.getTitleLink=function(){var E=D.getTitle();
  3777. return'<a href="'+Klib.getFixedHref(D.link)+'">'+Klib.htmlspecialchars(E)+"</a>"
  3778. };
  3779. D.getTitle=function(){if(D.htmldoc&&D.htmldoc.title){return D.htmldoc.title
  3780. }else{if(D.link.href){return Klib.getFixedHref(D.link)
  3781. }else{Klib.warning("Clue has no link getTitle()",D.id);
  3782. return""
  3783. }}};
  3784. function B(){D.includeExps=Klib.KRegex.toRegexArr(D.includeUrls);
  3785. D.excludeExps=Klib.KRegex.toRegexArr(D.excludeUrls);
  3786. D.mimeTypeExps=D.mimeTypes?Klib.KRegex.toRegexArr(D.mimeTypes):[]
  3787. }B();
  3788. D.regsterFileTypes=function(){if(D.includeUrls){for(var F=0;
  3789. F<D.includeUrls.length;
  3790. F++){var E=D.includeUrls[F];
  3791. if(E.match){var G=E.match(/^\*\.(\w+)$/);
  3792. if(G){Klib.LinkScent.registerFileType(G[1].toLowerCase(),D.id)
  3793. }G=E.match(/^(\w+:)(\*)?$/);
  3794. if(G){Klib.LinkScent.registerProtocol(G[1].toLowerCase())
  3795. }}}}};
  3796. D.regsterFileTypes();
  3797. D.isValidUrl=function(F){if(!F){return false
  3798. }var H=false;
  3799. for(var G=0;
  3800. G<D.includeExps.length;
  3801. G++){if(F.match(D.includeExps[G].regex)){H=true
  3802. }}if(H){for(var E=0;
  3803. E<D.excludeExps.length;
  3804. E++){if(F.match(D.excludeExps[E].regex)){H=false
  3805. }}}return H
  3806. };
  3807. D.isValidLink=function(F){var E=Klib.getFixedHref(F);
  3808. if(!E){D.debug("link not valid [no href]",D.id,F);
  3809. return false
  3810. }if(!D.isValidUrl(E)){D.debug("link not valid  [isValidUrl]",D.id,F.href);
  3811. return false
  3812. }if(D.isValid){try{return D.isValid(F)
  3813. }catch(G){Klib.warning("clue.isValidLink failed",G,F);
  3814. return false
  3815. }}return true
  3816. };
  3817. D.isValidHtmlDoc=function(E){if(D.mimeTypes){for(var F=0;
  3818. F<D.mimeTypeExps.length;
  3819. F++){if(E.contentType.match(D.mimeTypeExps[F].regex)){return true
  3820. }}return false
  3821. }else{return E.isHtml
  3822. }};
  3823. D.getContentUrl=function(){D.subs.userId=Klib.Global.get("uid");
  3824. D.subs.clueId=D.id;
  3825. D.subs.clueUrl=D.localUrl;
  3826. D.subs=Klib.merge(D.subs,Klib.Clue.getLinkSubstitutions(D.link));
  3827. return Klib.substitute(D.contentUrl,D.subs)
  3828. };
  3829. if(A.getContentUrl){D.getContentUrl=Klib.cloneFunction(A.getContentUrl)
  3830. }D.onHead=function(G){D.headers=G.headers;
  3831. D.contentLength=G.contentLength;
  3832. D.updateContent();
  3833. if(G.headers.content_type){var F=G.headers.content_type;
  3834. if(Klib.isIE&&D.maxContentLength&&(D.contentLength>D.maxContentLength)){D.setState(Klib.Clue.STATE_COMPLETE,true);
  3835. return false
  3836. }for(var E=0;
  3837. E<D.mimeTypeExps.length;
  3838. E++){if(F.match(D.mimeTypeExps[E].regex)){return true
  3839. }}}D.setState(Klib.Clue.STATE_COMPLETE,true);
  3840. return false
  3841. };
  3842. D.cacheId=function(E){E=E||D.getContentUrl(D.link);
  3843. return(D.id+"_"+Klib.hash(E))
  3844. };
  3845. D.getContent=function(H,F){F=F||false;
  3846. if(D.staticContent){D.content=D.staticContent(D);
  3847. D.setState(Klib.Clue.STATE_COMPLETE,true);
  3848. return 
  3849. }if(D.framed){D.content='<div align="center"><iframe onload="handle3rdPartyFrameLoad(this);" src="'+D.getContentUrl(D.link)+'" clueid="'+D.id+'" style="width: '+D.frameWidth+"; height: "+D.frameHeight+'; border: none;" frameborder="0"></iframe></div>';
  3850. D.setState(Klib.Clue.STATE_COMPLETE,true);
  3851. return 
  3852. }if(D.cache&&D.contentUrl&&!F){var G=Klib.Clue.cache.get(D.cacheId());
  3853. if(G){D.content=G.content;
  3854. D.setState(Klib.Clue.STATE_COMPLETE,true);
  3855. return 
  3856. }}var I=(H=="force")||(H==D.retrieveEvent);
  3857. if(I){if(D.contentUrl){var E=D.getContentUrl(D.link);
  3858. D.currContentUrl=E;
  3859. D.currContentPage=E.replace(/#.*$/,"");
  3860. D.subs.contentUrl=E;
  3861. D.debug("retrieving content for "+D.id+" from "+E);
  3862. D.fetch(E,F)
  3863. }else{D.updateContent();
  3864. D.setState(Klib.Clue.STATE_COMPLETE,true)
  3865. }}};
  3866. D.fetch=function(F,G){D.htmldoc=null;
  3867. var E=new Klib.HTMLDoc.Obj(F);
  3868. E.fetchHead=true;
  3869. E.fetchContent=true;
  3870. E.maxContentLength=Klib.Pref.getInt("Clue.maxContentLength")*1024;
  3871. E.parseHTML=true;
  3872. if(Klib.Pref.get("Privacy.addXClueHeaders",true)){E.requestHeaders["X-clue"]="fetch"
  3873. }E.addEvent("complete",D.receiveContent);
  3874. D.setState(Klib.Clue.STATE_RETRIEVING,true);
  3875. E.fetch(G)
  3876. };
  3877. D.getSub=function(E){return D.subs[E]?D.subs[E]:""
  3878. };
  3879. D.updateContent=function(){D.subs.faviconlink=Klib.FavIcon.createLink(Klib.getFixedHref(D.link),true);
  3880. for(var K in D.templateVariables){var F=D.templateVariables[K];
  3881. D.subs[K]="";
  3882. try{if(typeof F=="string"){var J="";
  3883. var N=(F.indexOf("?")!=0);
  3884. if(!N){F=F.substr(1)
  3885. }if(F.match(/^css:/i)){F=F.replace(/^css:\s*/i,"");
  3886. D.debug("css:selector",F);
  3887. var P=F.split(/\s*,\s*/g);
  3888. var L=[];
  3889. var G=[];
  3890. for(var I=0;
  3891. I<P.length;
  3892. I++){if(P[I].match(/^\!/)){G.push(P[I].replace(/\!/g,""))
  3893. }else{L.push(P[I])
  3894. }}if(G.length){var Q=Klib.getEles(G.join(", "),D.document);
  3895. D.debug("css:removals",G,Q);
  3896. for(var H=Q.length-1;
  3897. H>=0;
  3898. H--){Klib.removeEle(Q[H])
  3899. }}if(L.length){if(L=="title"&&D.document.title){J+=D.document.title
  3900. }else{var E=Klib.getEles(L.join(", "),D.document);
  3901. D.debug("css:keepEles",L,E);
  3902. for(var I=0;
  3903. I<E.length;
  3904. I++){J+=Klib.outerHTML(E[I])
  3905. }}}if(!J){Klib.warning("failed to find templateVariable {"+K+"}",F);
  3906. if(N){D.failed()
  3907. }}}else{J=Klib.substitute(F,D.subs)
  3908. }J=Klib.Html.removeFormElements(J);
  3909. D.subs[K]=J
  3910. }else{if(typeof F=="function"){D.subs[K]=D.templateVariables[K](D)
  3911. }else{Klib.warning("Invalid templateVariables type",D.id,K,typeof (F))
  3912. }}D.debug("templateVariable["+K+"]="+D.subs[K])
  3913. }catch(M){Klib.warning(D.id,"failed to calculate templateVariable {"+K+"}",M)
  3914. }if(D.extractContentFailed){break
  3915. }}D.subs.clueInfoBlock=D.clueInfoBlock();
  3916. for(var O in D.subs){var R=D.id+"_"+O;
  3917. Klib.Clue.cluescriptVariableCache.add(R,D.subs[O])
  3918. }if(D.tempTemplateHTML){D.content=Klib.substitute(D.tempTemplateHTML,D.subs);
  3919. D.tempTemplateHTML=""
  3920. }else{D.content=Klib.substitute(D.templateHTML,D.subs)
  3921. }};
  3922. D.iconHTML=function(F){var E={"class":"interclue-clue-icon",width:16,height:16,border:0};
  3923. E=Klib.merge(E,F);
  3924. if(D.sprite){return Klib.sprites[D.sprite].getHTML(E)
  3925. }else{E.src=D.localUrl+"/"+D.icon;
  3926. return Klib.Html.tag("img",E)
  3927. }};
  3928. D.generateLinkscentTooltip=function(E){E=E||D.link;
  3929. if(typeof D.linkscentTooltip=="function"){return D.linkscentTooltip(E)
  3930. }else{return Klib.substitute(D.linkscentTooltip,Klib.Clue.getLinkSubstitutions(E))
  3931. }};
  3932. D.clueInfoBlockAdd=function(E){D.link.linkscent.clueInfoBlocks=D.link.linkscent.clueInfoBlocks||{};
  3933. D.link.linkscent.clueInfoBlocks[D.id]=E
  3934. };
  3935. D.clueInfoBlock=function(G){G=G||D.link;
  3936. var E="";
  3937. G.linkscent.clueInfoBlocks=G.linkscent.clueInfoBlocks||{};
  3938. if(D.linkscentTooltip&&D.showLinkscentTooltipInClue){G.linkscent.clueInfoBlocks[D.id]=D.iconHTML()+D.generateLinkscentTooltip()
  3939. }var H=G.linkscent.clueInfoBlocks;
  3940. if(G.linkscent.clueInfoBlocks!={}){E="";
  3941. for(var F in H){if(H[F]){E+="<li>"+H[F]+"</li>"
  3942. }}if(E){E='<ul class="interclue-clue-infoblock">'+E+"</ul>"
  3943. }}return E
  3944. };
  3945. D.initContentFrame=function(){D.document=D.iframe.doc;
  3946. D.document.title=D.htmldoc.title||D.currContentUrl;
  3947. var E=(/<body[^>]*>/i.test(D.cleanHTML))?D.cleanHTML.replace(/^[\W\w]*<body[^>]*>/i,""):D.cleanHTML;
  3948. D.document.body.innerHTML="";
  3949. D.document.body.innerHTML=E;
  3950. Klib.tryEach("Klib.ClueBridge.parserFrame.win.stop();","Klib.ClueBridge.parserFrame.doc.execCommand('Stop');");
  3951. D.updateContent();
  3952. D.document=null;
  3953. D.setState(Klib.Clue.STATE_COMPLETE,true)
  3954. };
  3955. D.receiveContent=function(E){if(D.currContentPage==E.urlPage||Klib.inArray(D.redirects,D.currContentPage)){D.link.linkscent.forceRefresh=false;
  3956. D.htmldoc=E;
  3957. if(E.error&&(D.id!="fileNotFound")){Klib.error("clue.receiveContent() html.error",D.id);
  3958. D.receiveContentError(E.status,E.statusText)
  3959. }else{if(E.isFrameset){D.contentUrlIsFrameset=true;
  3960. var G=Klib.Html.findLargestFrame(E.disabledHTML,E.url);
  3961. if(G&&G.src){if(D.redirects.length<Klib.Pref.get("ClueScript.maxRedirects",3)){if(!Klib.inArray(D.redirects,G.src)){D.content="redirecting to "+G.src;
  3962. if(!Klib.inArray(D.redirects,E.urlPage)){D.redirects.push(E.urlPage)
  3963. }D.fetch(G.src)
  3964. }else{D.receiveContentError(Klib.Ajax.ERROR_CIRCULAR_REDIRECT,Klib.string("ajax.error.redirect.circular"))
  3965. }}else{D.receiveContentError(Klib.Ajax.ERROR_REDIRECT_LIMIT_REACHED,Klib.string("ajax.error.redirect.limit"))
  3966. }}else{D.failed()
  3967. }}else{if(D.isValidHtmlDoc(E)){D.headers=E.headers;
  3968. D.origHTML=E.origHTML;
  3969. D.cleanHTML=E.cleanHTML;
  3970. if(D.cleanHTML){var F=D.cleanHTML;
  3971. D.subs.title=E.title;
  3972. D.setState(Klib.Clue.STATE_PARSING,true);
  3973. if(D.templateVariables){if(!D.iframe){D.iframe=Klib.Iframe.create(D.id+"_iframe",Klib.ClueBridge.parserFrame.doc.body,{display:"none"})
  3974. }Klib.Iframe.init(D.iframe,D.initContentFrame)
  3975. }else{if(/<body[^>]*>/i.test(F)){D.content=F.replace(/^[\W\w]*<body[^>]*>/i,"");
  3976. D.setState(Klib.Clue.STATE_COMPLETE,true)
  3977. }else{Klib.warning("Clue.receiveContent() document has no body tag?",D.id,F);
  3978. D.content="";
  3979. D.setState(Klib.Clue.STATE_COMPLETE,true)
  3980. }}}else{D.updateContent();
  3981. D.setState(Klib.Clue.STATE_COMPLETE,true)
  3982. }}else{if(E.responseXML&&D.acceptXML){D.updateContent();
  3983. D.setState(Klib.Clue.STATE_COMPLETE,true)
  3984. }else{D.failed();
  3985. D.setState(Klib.Clue.STATE_ERROR,true)
  3986. }}}}}else{Klib.error("_this.currContentPage != htmldoc.urlPage",D.id,D.currContentPage,E.urlPage)
  3987. }};
  3988. D.receiveContentError=function(E,G){Klib.warning(D.id+" receiveContentError",E,G);
  3989. D.subs.status=E;
  3990. D.subs.statusText=G;
  3991. var F=Klib.htmlspecialchars(D.currContentUrl);
  3992. if(E==Klib.Ajax.REQUEST_TIMED_OUT){D.error=Klib.string("clue.error.request.timed.out",F,Klib.Pref.get("ClueScript.defaultTimeout",10))
  3993. }else{D.error=Klib.string("clue.error.generic",E,G,F);
  3994. D.content=D.error
  3995. }D.setState(Klib.Clue.STATE_ERROR,true)
  3996. };
  3997. D.setState=function(F,E){D.state=F;
  3998. if(D.contentUrl&&(F==Klib.Clue.STATE_COMPLETE)&&!D.extractContentFailed){Klib.Clue.cache.add(D.cacheId(),{clueId:D.id,content:D.content,extractContentFailed:D.extractContentFailed})
  3999. }D.debug(D.id+" state = "+F+"("+Klib.Clue.stateStr(F)+")");
  4000. if(D.link&&D.link.linkscent&&D.link.linkscent.onClueStateChange){try{D.link.linkscent.onClueStateChange(D)
  4001. }catch(G){Klib.error("linkscent.onClueStateChange",G,D.id,D.link)
  4002. }}if(E&&(D==Klib.Clue.currentClue)){Klib.ClueFrame.updateContent(D)
  4003. }};
  4004. D.hide=function(){};
  4005. D.reload=function(){D.debug(D.id,"resetting...");
  4006. D.content=Klib.string("clue.reloading");
  4007. D.setState(Klib.Clue.STATE_LOADED);
  4008. D.getContent("force",true)
  4009. };
  4010. D.debug=function(){if(D.debugging){Klib.debugClue(D.id,arguments)
  4011. }};
  4012. D.loadTemplate=function(){if(D.templateFile){D.debug("loading template file",D.templateFile);
  4013. Klib.Ajax.get(D.localUrl+"/"+D.templateFile,D.loadTemplateReceive)
  4014. }};
  4015. D.loadTemplateReceive=function(E){if(E.responseText&&!E.error){D.debug("loaded template file",E.responseText);
  4016. D.templateHTML=E.responseText
  4017. }else{D.debug("FAILED: loading template file",E.status,E.statusText)
  4018. }};
  4019. D.failed=function(){D.extractContentFailed=true;
  4020. D.setState(Klib.Clue.STATE_ERROR)
  4021. };
  4022. if(D.templateFile){D.loadTemplate()
  4023. }}
  4024. }if(Klib.install("ClueBridge",0.1,"Clue")){Klib.ClueBridge.sourceDoc=null;
  4025. Klib.ClueBridge.URL=Klib.Url.parse("");
  4026. Klib.ClueBridge.sourceWin=null;
  4027. Klib.ClueBridge.lastDoc=null;
  4028. Klib.timerStatus=0;
  4029. Klib.clearStatus=function(){try{Klib.ClueBridge.sourceWin.status=""
  4030. }catch(A){}};
  4031. Klib.status=function(A){Klib.Toolbar.status(A,"message")
  4032. };
  4033. Klib.ClueBridge.init=function(){if(!Klib.ClueBridge.initalized){if(document.body){Klib.ClueBridge.initalized=true;
  4034. Klib.ClueBridge.checkParserFrames();
  4035. Klib.setInterval("checkWindows",Klib.ClueBridge.checkWindows,200)
  4036. }else{Klib.setNamedTimer("checkWindows",Klib.ClueBridge.init,500)
  4037. }}};
  4038. Klib.ClueBridge.getButtonFrame=function(){var A=top.document.getElementById("interclue-custom-buttons");
  4039. if(A){if(A.contentWindow){return A.contentWindow
  4040. }else{throw Error("Unable to find browser.contentWindow for #interclue-custom-buttons")
  4041. }}else{throw Error("Unable to find browser object #interclue-custom-buttons")
  4042. }};
  4043. Klib.ClueBridge.checkParserFrames=function(){if(!Klib.ClueBridge.parserFrame){Klib.ClueBridge.parserFrame=Klib.Iframe.create("parserFrame",document.body,false,false,{display:"none"});
  4044. Klib.Iframe.init(Klib.ClueBridge.parserFrame,Klib.ClueBridge.checkParserFrames)
  4045. }else{if(!Klib.ClueBridge.parserFrameTemp&&Klib.ClueBridge.parserFrame.doc.body){Klib.ClueBridge.parserFrameTemp=Klib.Iframe.create("parserFrameTemp",Klib.ClueBridge.parserFrame.doc.body,false,false,{display:"none"});
  4046. Klib.Iframe.init(Klib.ClueBridge.parserFrameTemp)
  4047. }}};
  4048. Klib.ClueBridge.initWindows=function(){throw Error("Klib.ClueBridge.initWindows not written for "+Klib.platform)
  4049. };
  4050. Klib.ClueBridge.showHint=function(C,B,A){Klib.error("STUB: Klib.ClueBridge.showHint not written for "+Klib.platform)
  4051. };
  4052. Klib.ClueBridge.checkWindows=function(){if(Klib.User.winLoggedIn){Klib.ClueBridge.initWindows()
  4053. }else{Klib.clearTimer("checkWindows")
  4054. }};
  4055. Klib.ClueBridge.preventPluginConflicts=function(F){if(Klib.platform!="siteclues"&&Klib.Global.get("loggedIn")){var E=Klib.getWin(F);
  4056. var A=F.getElementsByTagName("script");
  4057. for(var C=0;
  4058. C<A.length;
  4059. C++){var B=A[C];
  4060. if(B.src&&B.src.match(/interclue/i)){if(E.Klib){try{E.Klib.User.logout("Klib.ClueBridge.preventPluginConflicts")
  4061. }catch(D){Klib.error("failed to logout siteclues user",D)
  4062. }}delete E.Klib;
  4063. Klib.removeEle(B);
  4064. if(F.cluebridge){delete F.cluebridge
  4065. }}}}};
  4066. Klib.ClueBridge.getDocumentLink=function(B){if(!B.documentLink){var C=B.title;
  4067. var A=B.createElement("a");
  4068. A.href=B.URL;
  4069. A.innerHTML=C;
  4070. B.documentLink=A
  4071. }return B.documentLink
  4072. };
  4073. Klib.ClueBridge.newDocument=function(A){if(!A){return 
  4074. }A.cluebridge=A.cluebridge||{};
  4075. if(Klib.Global.get("loggedIn")||(Klib.platform=="siteclues")){if(Klib.Pref.get("ClueFrame.frameType")=="window"){Klib.ClueFrame.killUnusedFrames()
  4076. }Klib.LinkScent.initDoc(A);
  4077. Klib.LinkCursor.initDoc(A);
  4078. Klib.Clue.initDoc(A);
  4079. Klib.Cluebar.initDoc(A)
  4080. }else{Klib.ClueBridge.cleanUpDoc(A)
  4081. }};
  4082. Klib.ClueBridge.rebuildDoc=function(A){A=A||Klib.ClueBridge.lastDoc;
  4083. if(A){Klib.ClueBridge.cleanUpDoc(A);
  4084. Klib.ClueBridge.initDoc(A,true)
  4085. }};
  4086. Klib.ClueBridge.handleDocumentSecurityChange=function(){Klib.ClueBridge.rebuildDoc(Klib.ClueBridge.lastDoc)
  4087. };
  4088. Klib.ClueBridge.cleanUpDoc=function(C){C=C||Klib.ClueBridge.sourceDoc;
  4089. if(C&&C.cluebridge){var B=Klib.getWin(C);
  4090. var D=Klib.getDocs(B,true);
  4091. for(var A=0;
  4092. A<D.length;
  4093. A++){C=D[A];
  4094. C.cluebridge=null;
  4095. Klib.ClueFrame.kill();
  4096. Klib.Mouse.cleanUpDoc(C);
  4097. Klib.Key.cleanUpDoc(C);
  4098. Klib.LinkScent.cleanupDoc(C);
  4099. Klib.LinkCursor.cleanupDoc(C);
  4100. Klib.Clue.cleanupDoc(C);
  4101. Klib.Drag.cleanupDoc(C);
  4102. Klib.Hover.cleanupDoc(C);
  4103. Klib.Cluebar.cleanupDoc(C);
  4104. C.interclueInitalized=null;
  4105. C.interclueValidDoc=null;
  4106. C.interclueClueBridgeInitalized=null;
  4107. Klib.removeAllEvents(C)
  4108. }}else{}};
  4109. Klib.ClueBridge.getTopDoc=function(D){var C=Klib.getWin(D);
  4110. while(C&&C.parent){var A="";
  4111. try{A=C.parent.document.URL
  4112. }catch(B){}if(C!=C.parent&&A.match(/^http(s)?:/i)){C=C.parent
  4113. }else{break
  4114. }}return(C&&C.document)?C.document:null
  4115. };
  4116. Klib.ClueBridge.initHTMLDoc=function(E,C){var B=Klib.Security.isDocEnabled(E);
  4117. if(C||!E.interclueInitalized){E.interclueInitalized=true;
  4118. E.cluebridge=E.cluebridge||{};
  4119. if(B){Klib.Mouse.initDoc(E);
  4120. Klib.Key.initDoc(E);
  4121. E.cluebridge.linkcount=0;
  4122. Klib.ClueFrame.removeIframe(E);
  4123. var D=Klib.getWin(E);
  4124. var A=Klib.ClueBridge.getTopDoc(E);
  4125. if(A&&(E!=A)&&!Klib.isFrameset(A)&&(A.URL.indexOf("/selenuim-server/")==-1)){E.interclueParentDoc=A
  4126. }if(Klib.Tutorial.isTutorialUrl(E.URL)){D._=_;
  4127. D.translate=Klib.translate;
  4128. D.interclueHotKeyText=function(){return Klib.keyCodesToString(Klib.Pref.get("ClueFrame.hotKey"))
  4129. };
  4130. D.initOptionLinks=Klib.Pref.initDoc;
  4131. Klib.Tutorial.fireEvent(E,"interclueinitdoc")
  4132. }}}if(B&&(C||(E.links&&E.cluebridge&&(E.cluebridge.linkcount!=E.links.length)))){E.cluebridge.linkcount=E.links.length;
  4133. Klib.ClueBridge.newDocument(E)
  4134. }};
  4135. Klib.ClueBridge.isValidDocument=function(B){if(B&&typeof (B.interclueValidDoc)!=="undefined"&&B.interclueValidDoc!==null){return B.interclueValidDoc
  4136. }else{if(B&&B.URL){if((B.body&&B.body.contentEditable&&B.body.contentEditable===true)||(B.designMode=="on")){B.interclueValidDoc=false
  4137. }else{var A=Klib.Url.parse(B.URL);
  4138. B.interclueValidDoc=(A.protocol=="http:"||A.protocol=="https:"||Klib.Tutorial.isTutorialUrl(B.URL))
  4139. }return B.interclueValidDoc
  4140. }else{return false
  4141. }}};
  4142. Klib.ClueBridge.isWindowInsideClueFrame=function(C){try{while(C){if(C.isClueFrame){return true
  4143. }if(C.frameElement){var A=Klib.getWin(C.frameElement);
  4144. if(C!=A){C=A
  4145. }else{return false
  4146. }}else{return false
  4147. }}}catch(B){}return false
  4148. };
  4149. Klib.ClueBridge.initDoc=function(A,B){Klib.documentIsUnloading=false;
  4150. if(!A){return 
  4151. }var C=Klib.getWin(A);
  4152. if(Klib.ClueBridge.isWindowInsideClueFrame(C)){A.interclueClueBridgeInitalized=true;
  4153. return 
  4154. }if(!A.interclueClueBridgeInitalized){Klib.Stats.viewPage(A)
  4155. }if((Klib.ClueBridge.lastDoc!=A)||!A.interclueClueBridgeInitalized){A.interclueClueBridgeInitalized=true;
  4156. Klib.ClueBridge.lastDoc=A;
  4157. Klib.ClueBridge.URL=(A.URL)?Klib.Url.parse(A.URL):Klib.Url.parse("");
  4158. Klib.GEvent.fire("newdocument",A);
  4159. Klib.Toolbar.refresh(A);
  4160. Klib.ClueBridge.checkParserFrames();
  4161. if(A.URL&&A.URL.indexOf(Klib.baseUrl+"/debug/")==0){C.Klib=Klib;
  4162. C.debug=debug;
  4163. C._=_;
  4164. C.$=$;
  4165. if(C.init){C.init()
  4166. }return 
  4167. }}if(Klib.ClueBridge.isValidDocument(A)&&A.body){Klib.ClueBridge.initHTMLDoc(A)
  4168. }else{}};
  4169. Klib.ClueBridge.cleanUpAllDocs=function(){var B=Klib.Browser.getAllDocs();
  4170. for(var A=0;
  4171. A<B.length;
  4172. A++){Klib.ClueBridge.cleanUpDoc(B[A])
  4173. }};
  4174. Klib.ClueBridge.handleLogin=function(A){if(Klib.ClueBridge.sourceDoc){Klib.ClueBridge.initDoc(Klib.ClueBridge.sourceDoc,true)
  4175. }};
  4176. Klib.ClueBridge.handleLogout=function(A){if(Klib.ClueBridge.sourceDoc){Klib.ClueBridge.cleanUpDoc(Klib.ClueBridge.sourceDoc)
  4177. }};
  4178. Klib.ClueBridge.isBrowserWindow=function(){if(window&&window.toolbar){return window.toolbar.visible
  4179. }else{return true
  4180. }};
  4181. Klib.ClueBridge.openReferrerPage=function(){var A=Klib.Toolbar.lastDoc;
  4182. if(A&&A.referrer){Klib.ClueBridge.openUrl(A.referrer,true,true,true)
  4183. }};
  4184. Klib.ClueBridge.openUrl=function(B,D,C,A){throw Error("Klib.ClueBridge.openUrl not written for "+Klib.platform)
  4185. };
  4186. Klib.ClueBridge.visitWebsite=function(){var A=Klib.getInterclueUrl("website",true);
  4187. Klib.ClueBridge.openUrl(A,true,true)
  4188. };
  4189. Klib.ClueBridge.getBrowserByUrl=function(A){return false
  4190. };
  4191. Klib.ClueBridge.copyToClipboard=function(A){throw Error("Klib.ClueBridge.openUrl not written for "+Klib.platform)
  4192. };
  4193. Klib.ClueBridge.isMouseOverHTMLDoc=function(){return true
  4194. };
  4195. Klib.ClueBridge.setState=function(B){switch(B){case"enabled":Klib.Security.enableSiteFromDoc(Klib.ClueBridge.sourceDoc);
  4196. break;
  4197. case"disabled-for-domain":var A=Klib.Security.disableSiteFromDoc(Klib.ClueBridge.sourceDoc);
  4198. break;
  4199. case"disabled-until-restart":Klib.User.logout("statusbarbutton",true);
  4200. break;
  4201. case"disabled":Klib.User.logout("statusbarbutton");
  4202. break;
  4203. default:throw Error("Klib.ClueBridge.setState: Unknown state ["+B+"]")
  4204. }Klib.GEvent.fire("statechange",B)
  4205. };
  4206. Klib.GEvent.addEvent("documentsecuritychange",Klib.ClueBridge.handleDocumentSecurityChange)
  4207. }if(Klib.install("ClueFrame",0.1,"ClueBridge")){Klib.ClueFrame.floatingWin=null;
  4208. Klib.ClueFrame.iframe=null;
  4209. Klib.ClueFrame.lastHTML="";
  4210. Klib.ClueFrame.lastClue=null;
  4211. Klib.ClueFrame.win=null;
  4212. Klib.ClueFrame.doc=null;
  4213. Klib.ClueFrame.CLUEFRAME_MIN_HEIGHT=200;
  4214. Klib.ClueFrame.CLUEFRAME_MAX_HEIGHT=screen.height;
  4215. Klib.ClueFrame.CLUEFRAME_MIN_WIDTH=285;
  4216. Klib.ClueFrame.CLUEFRAME_MAX_WIDTH=screen.width;
  4217. Klib.ClueFrame.visible=false;
  4218. Klib.ClueFrame.building=false;
  4219. Klib.ClueFrame.buttons=[];
  4220. Klib.ClueFrame.clueButtons=[];
  4221. Klib.ClueFrame.customButtons={};
  4222. Klib.ClueFrame.currentReferrerDoc=null;
  4223. Klib.ClueFrame.getCurrentURL=function(){var A=Klib.ClueFrame.getIframe();
  4224. return(A&&A.currentURL)?A.currentURL:null
  4225. };
  4226. Klib.ClueFrame.getCurrentLink=function(){var A=Klib.ClueFrame.getIframe();
  4227. return(A&&A.currentLink)?A.currentLink:null
  4228. };
  4229. Klib.ClueFrame.isWindowLargeEnough=function(){var A=Klib.getRect(top);
  4230. return(A.width>Klib.Pref.get("Browser.minimumWidth"))&&(A.height>Klib.Pref.get("Browser.minimumHeight"))
  4231. };
  4232. Klib.ClueFrame.clueHistory=function(){var A=this;
  4233. A.index=-1;
  4234. A.items=[];
  4235. A.addItem=function(D){for(var B=0;
  4236. B<A.items.length;
  4237. B++){if(A.items[B]==D){return 
  4238. }}var C=A.index+1;
  4239. A.items[C]=D;
  4240. for(var B=A.items.length-1;
  4241. B>C;
  4242. B--){A.items.pop()
  4243. }A.index=C
  4244. };
  4245. A.show=function(B){if(B<0||(B>=A.items.length)){Klib.error("Invalid index "+B+" for history object");
  4246. return 
  4247. }var C=A.items[B];
  4248. Klib.Clue.currentEle=null;
  4249. Klib.Clue.hoverLink=C;
  4250. Klib.ClueFrame.iframe.dontReposition=true;
  4251. Klib.LinkScent.setupLink(C);
  4252. C.linkscent.forceLinkscents=true;
  4253. Klib.Clue.showClues("historyShow");
  4254. C.linkscent.forceLinkscents=false;
  4255. Klib.ClueFrame.iframe.dontReposition=null;
  4256. A.index=B;
  4257. Klib.ClueFrame.refreshButtons()
  4258. };
  4259. A.showPrev=function(){if(A.index>0){A.show(A.index-1)
  4260. }};
  4261. A.showNext=function(){if(A.index<A.items.length-1){A.show(A.index+1)
  4262. }};
  4263. A.canShowNext=function(){return(A.index<A.items.length-1)
  4264. };
  4265. A.canShowPrev=function(){return(A.index>0)
  4266. };
  4267. A.dump=function(){var C="== Clue History ==\n";
  4268. C+="index: = "+A.index;
  4269. C+="\n=== items "+A.items.length+"===\n";
  4270. for(var B=0;
  4271. B<A.items.length;
  4272. B++){if(B==A.index){C+="*"
  4273. }C+=A.items[B].href+"\n"
  4274. }return C
  4275. }
  4276. };
  4277. Klib.ClueFrame.getHistory=function(){var A=Klib.ClueFrame.getIframe();
  4278. if(!A){Klib.error("Unable to find clueviewer");
  4279. return false
  4280. }else{if(!A.clueHistory){A.clueHistory=new Klib.ClueFrame.clueHistory()
  4281. }}return A.clueHistory
  4282. };
  4283. Klib.ClueFrame.historyPrev=function(){var A=Klib.ClueFrame.getHistory();
  4284. if(A){A.showPrev()
  4285. }};
  4286. Klib.ClueFrame.historyNext=function(){var A=Klib.ClueFrame.getHistory();
  4287. if(A){A.showNext()
  4288. }};
  4289. Klib.ClueFrame.showReferrerPageClueFrame=function(){var C=Klib.ClueBridge.sourceDoc;
  4290. var A=C.referrer;
  4291. if(C&&A&&Klib.Clue.docAllowsClues(C)){var B=Klib.ClueFrame.createFakeLink(A,A,"interclue-referrer-link",C);
  4292. Klib.Clue.currentEle=null;
  4293. Klib.Clue.hoverLink=B;
  4294. Klib.Clue.setEventPosition(Klib.Mouse);
  4295. Klib.Clue.showClues("showReferrerPageClueFrame")
  4296. }else{if(!A){alert(Klib.string("clueframe.error.cannot.find.referrer"))
  4297. }else{alert(Klib.string("clueframe.error.document.doesnt.allow.clues"))
  4298. }}};
  4299. Klib.ClueFrame.getViewPortRect=function(G){var C=18;
  4300. if(Klib.Pref.get("ClueFrame.frameType")=="iframe"&&Klib.ClueBridge.sourceDoc){G=G||Klib.ClueBridge.sourceDoc;
  4301. var F=Klib.getWin(G);
  4302. if(!F){return false
  4303. }var B=0;
  4304. var A=0;
  4305. if(F.innerWidth){B=F.innerWidth;
  4306. A=F.innerHeight
  4307. }else{if(G.documentElement&&(G.documentElement.clientWidth)){B=G.documentElement.clientWidth;
  4308. A=G.documentElement.clientHeight
  4309. }else{if(G.body&&(G.body.clientWidth)){B=G.body.clientWidth;
  4310. A=G.body.clientHeight
  4311. }}}var E=0;
  4312. var D=0;
  4313. if(typeof F.pageXOffset=="number"){D=F.pageXOffset;
  4314. E=F.pageYOffset
  4315. }else{if(G.body&&(G.body.scrollLeft||G.body.scrollTop)){D=G.body.scrollLeft;
  4316. E=G.body.scrollTop
  4317. }else{if(G.documentElement&&(G.documentElement.scrollLeft||G.documentElement.scrollTop)){D=G.documentElement.scrollLeft;
  4318. E=G.documentElement.scrollTop
  4319. }}}if(B&&A){return Klib.rect(D,E,B-C,A)
  4320. }else{return false
  4321. }}else{if(Klib.Pref.get("ClueFrame.frameType")=="window"){return Klib.getRect(screen)
  4322. }else{return false
  4323. }}};
  4324. Klib.ClueFrame.verifyPosition=function(B,H,E,A,G){var F={x:B,y:H};
  4325. var C=Klib.ClueFrame.getViewPortRect(G);
  4326. if(C){if(Klib.ClueFrame.floatingWin&&Klib.ClueFrame.floatingWin.document){E=Klib.ClueFrame.floatingWin.outerWidth||Klib.ClueFrame.floatingWin.document.body.clientWidth;
  4327. A=Klib.ClueFrame.floatingWin.outerHeight||Klib.ClueFrame.floatingWin.document.body.clientHeight
  4328. }var D=Klib.rect(B,H,E,A);
  4329. if(D.right>C.right){D.setRight(B-(Klib.Pref.get("ClueFrame.frameMargin")*2))
  4330. }if(D.left<C.left){D.setLeft(C.left)
  4331. }if(D.bottom>C.bottom){D.setBottom(H-(Klib.Pref.get("ClueFrame.frameMargin")*2))
  4332. }if(D.top<C.top){D.setTop(C.top)
  4333. }F.x=D.left;
  4334. F.y=D.top
  4335. }return F
  4336. };
  4337. Klib.getDocumentScrollPt=function(C){var B={x:0,y:0};
  4338. var A=Klib.getWin(C);
  4339. if(A.pageYOffset){B.x=A.pageXOffset;
  4340. B.y=A.pageYOffset
  4341. }else{if(C.documentElement&&C.documentElement.scrollTop){B.x=C.documentElement.scrollLeft;
  4342. B.y=C.documentElement.scrollTop
  4343. }else{if(C.body){B.x=C.body.scrollLeft;
  4344. B.y=C.body.scrollTop
  4345. }}}return B
  4346. };
  4347. Klib.ClueFrame.calculatePointRelativeToDoc=function(H,F,G,B){if(G.screenX===undefined||G.screenY===undefined){var D=Klib.getWin(G);
  4348. var A=Klib.getRect(D);
  4349. G.screenX=A.left;
  4350. G.screenY=A.top
  4351. }if(B.screenX===undefined||B.screenY===undefined){var D=Klib.getWin(B);
  4352. var A=Klib.getRect(D);
  4353. B.screenX=A.left;
  4354. B.screenY=A.top
  4355. }var E=H+(G.screenX-B.screenX);
  4356. var C=F+(G.screenY-B.screenY);
  4357. return{x:E,y:C}
  4358. };
  4359. Klib.isFrameset=function(A){return(A&&A.body&&A.body.tagName&&A.body.tagName.toLowerCase()=="frameset")
  4360. };
  4361. Klib.ClueFrame.positionFrame=function(E,U,C){var N=16;
  4362. var A={x:0,y:0};
  4363. if(Klib.Pref.get("ClueFrame.frameType")=="iframe"){A.x=Klib.Clue.docX;
  4364. A.y=Klib.Clue.docY
  4365. }else{A.x=Klib.Clue.screenX;
  4366. A.y=Klib.Clue.screenY
  4367. }var M=Klib.limit(U||Klib.Pref.get("ClueFrame.width"),Klib.ClueFrame.CLUEFRAME_MIN_WIDTH,Klib.ClueFrame.CLUEFRAME_MAX_WIDTH);
  4368. var K=Klib.limit(C||Klib.Pref.get("ClueFrame.height"),Klib.ClueFrame.CLUEFRAME_MIN_HEIGHT,Klib.ClueFrame.CLUEFRAME_MAX_HEIGHT);
  4369. var I=0;
  4370. var G=0;
  4371. if(E&&E.linkscent&&E.linkscent.icons&&E.linkscent.icons.length){var S=E.linkscent.icons[0];
  4372. var H=Klib.getRect(S);
  4373. I=H.left+(N/2)+Klib.Pref.getInt("ClueFrame.frameMargin");
  4374. G=H.top+(N/2)+Klib.Pref.getInt("ClueFrame.frameMargin")
  4375. }else{if(E){var V=Klib.getRect(E);
  4376. I=V.right+Klib.Pref.getInt("ClueFrame.frameMargin");
  4377. G=V.bottom+Klib.Pref.getInt("ClueFrame.frameMargin")
  4378. }else{if(Klib.Pref.get("ClueFrame.frameType")=="iframe"){I=Klib.Clue.docX+Klib.Pref.getInt("ClueFrame.frameMargin");
  4379. G=Klib.Clue.docY+Klib.Pref.getInt("ClueFrame.frameMargin")
  4380. }else{if(Klib.Pref.get("ClueFrame.frameType")=="window"){I=Klib.Clue.screenX+Klib.Pref.getInt("ClueFrame.frameMargin");
  4381. G=Klib.Clue.screenY+Klib.Pref.getInt("ClueFrame.frameMargin")
  4382. }}}}if(Klib.Clue.currentEle){var B=Klib.getWin(Klib.Clue.currentEle);
  4383. if(B&&B.top&&B.top.document&&(B!=B.top)&&!Klib.isFrameset(B.top.document)){var P=Klib.ClueFrame.calculatePointRelativeToDoc(I,G,B.document,B.top.document);
  4384. I=P.x;
  4385. G=P.y
  4386. }}var F=Klib.ClueFrame.getIframe();
  4387. var W=Klib.getDoc(F);
  4388. if(Klib.isFirefox2&&Klib.docRenderMode(W)!="quirks"&&Klib.getStyle(W.body,"position")=="absolute"){var J=Klib.getBox2(W.body);
  4389. if(J){I-=J.left;
  4390. G-=J.top
  4391. }}var L=Klib.ClueFrame.verifyPosition(I,G,M,K,W);
  4392. var T=Klib.rect(L.x,L.y,M,K);
  4393. var O=Klib.ClueFrame.getViewPortRect(W);
  4394. if(Klib.pointInRect(A,T)){if(O){var Q=((A.x-O.left)>(O.width/2));
  4395. var D=((A.y-O.top)>(O.height/2));
  4396. M=(Q?(A.x-O.left):(O.right-A.x))-Klib.Pref.getInt("ClueFrame.frameMargin");
  4397. K=(D?(A.y-O.top):(O.bottom-A.y))-Klib.Pref.getInt("ClueFrame.frameMargin");
  4398. L.x=Q?O.left:(A.x+Klib.Pref.getInt("ClueFrame.frameMargin"));
  4399. L.y=D?O.top:(A.y+Klib.Pref.getInt("ClueFrame.frameMargin"))
  4400. }}if(Klib.Pref.get("ClueFrame.frameType")=="iframe"){if(Klib.ClueFrame.iframe.style.position=="fixed"){L.x-=O.left;
  4401. L.y-=O.top
  4402. }Klib.setStyle(Klib.ClueFrame.iframe,"left",L.x+"px");
  4403. Klib.setStyle(Klib.ClueFrame.iframe,"top",L.y+"px");
  4404. Klib.setStyle(Klib.ClueFrame.iframe,"width",M+"px");
  4405. Klib.setStyle(Klib.ClueFrame.iframe,"height",K+"px")
  4406. }else{if(Klib.Pref.get("ClueFrame.frameType")=="window"){try{Klib.ClueFrame.floatingWin.moveTo(L.x,L.y)
  4407. }catch(R){Klib.setNamedTimer("ClueFrame.positionFrame",Klib.ClueFrame.positionFrame,100)
  4408. }}}};
  4409. Klib.ClueFrame.checkFrame=function(B){switch(Klib.Pref.get("ClueFrame.frameType")){case"window":if(Klib.windowExists(Klib.ClueFrame.floatingWin)){Klib.ClueFrame.doc=Klib.ClueFrame.floatingWin.document;
  4410. Klib.ClueFrame.win=Klib.ClueFrame.floatingWin;
  4411. return true
  4412. }else{Klib.ClueFrame.buildWindow()
  4413. }break;
  4414. case"iframe":var C=Klib.getDoc(B);
  4415. if(C.interclueParentDoc){C=C.interclueParentDoc
  4416. }var A=C.getElementById("ClueFrame");
  4417. if(A&&A.doc&&A.win&&A.doc.clueframeReady){Klib.ClueFrame.iframe=A;
  4418. Klib.ClueFrame.doc=Klib.ClueFrame.iframe.doc;
  4419. Klib.ClueFrame.win=Klib.ClueFrame.iframe.win;
  4420. return true
  4421. }else{if(!A){Klib.ClueFrame.buildIFrame(C);
  4422. return false
  4423. }else{return false
  4424. }}break;
  4425. default:break
  4426. }return false
  4427. };
  4428. Klib.ClueFrame.resetSize=function(){if(Klib.Pref.get("ClueFrame.frameType")=="window"){if((Klib.ClueFrame.floatingWin.document.body.clientWidth!=Klib.Pref.get("ClueFrame.width"))||(Klib.ClueFrame.floatingWin.document.body.clientHeight!=Klib.Pref.get("ClueFrame.height"))){Klib.ClueFrame.floatingWin.resizeTo(Klib.Pref.get("ClueFrame.width"),Klib.Pref.get("ClueFrame.height"));
  4429. var B=Klib.ClueFrame.floatingWin.document.body.clientWidth;
  4430. var A=Klib.ClueFrame.floatingWin.document.body.clientHeight;
  4431. Klib.Pref.set("ClueFrame.width",B);
  4432. Klib.Pref.set("ClueFrame.height",A)
  4433. }}else{Klib.setStyle(Klib.ClueFrame.iframe,"width",Klib.Pref.get("ClueFrame.width")+"px");
  4434. Klib.setStyle(Klib.ClueFrame.iframe,"height",Klib.Pref.get("ClueFrame.height")+"px")
  4435. }};
  4436. Klib.ClueFrame.IEWindowChromeOffsetTop=0;
  4437. Klib.ClueFrame.IEWindowChromeOffsetLeft=0;
  4438. Klib.ClueFrame.handleWindowClose=function(A){Klib.Pref.set("ClueFrame.width",Klib.ClueFrame.floatingWin.document.body.clientWidth);
  4439. Klib.Pref.set("ClueFrame.height",Klib.ClueFrame.floatingWin.document.body.clientHeight)
  4440. };
  4441. Klib.ClueFrame.saveSize=function(){if(Klib.ClueFrame.resizingToContent){return 
  4442. }var B=0;
  4443. var A=0;
  4444. if(Klib.Pref.get("ClueFrame.frameType")=="window"&&Klib.ClueFrame.floatingWin&&Klib.ClueFrame.floatingWin.document&&Klib.ClueFrame.floatingWin.document.body){B=Klib.ClueFrame.floatingWin.document.body.clientWidth;
  4445. A=Klib.ClueFrame.floatingWin.document.body.clientHeight
  4446. }else{if(Klib.ClueFrame.iframe){B=Klib.ClueFrame.iframe.clientWidth;
  4447. A=Klib.ClueFrame.iframe.clientHeight
  4448. }}B=Klib.limit(B,Klib.ClueFrame.CLUEFRAME_MIN_WIDTH,Klib.ClueFrame.CLUEFRAME_MAX_WIDTH);
  4449. A=Klib.limit(A,Klib.ClueFrame.CLUEFRAME_MIN_HEIGHT,Klib.ClueFrame.CLUEFRAME_MAX_HEIGHT);
  4450. if(B&&A){Klib.Pref.set("ClueFrame.width",B);
  4451. Klib.Pref.set("ClueFrame.height",A)
  4452. }};
  4453. Klib.ClueFrame.buildWindow=function(){if(!Klib.ClueFrame.building){Klib.ClueFrame.building=true;
  4454. Klib.ClueFrame.floatingWin=null;
  4455. var B=Klib.Pref.get("ClueFrame.height");
  4456. var C=Klib.Pref.get("ClueFrame.width");
  4457. var A=Klib.Clue.screenX+Klib.Pref.get("ClueFrame.frameMargin")+Klib.ClueFrame.IEWindowChromeOffsetLeft;
  4458. var D=Klib.Clue.screenY+Klib.Pref.get("ClueFrame.frameMargin")+Klib.ClueFrame.IEWindowChromeOffsetTop;
  4459. Klib.ClueFrame.floatingWin=window.open("","ClueFrameWindow","top="+D+",left="+A+",dependent=yes,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,titlebar=no,height="+B+",width="+C+",innerHeight="+B+",innerWidth="+C);
  4460. Klib.ClueFrame.floatingWin.isClueFrame=true;
  4461. Klib.ClueFrame.building=false;
  4462. if(Klib.ClueFrame.floatingWin){Klib.ClueFrame.floatingWin.isClueFrameWindow=true;
  4463. Klib.ClueFrame.floatingWin.focus();
  4464. Klib.ClueFrame.floatingWin.closeWin=function(){var E=Klib.ClueFrame.floatingWin.document;
  4465. E.write('<script type="text/javascript">setTimeout(function(){window.close()},1);<\/script>');
  4466. Klib.ClueFrame.floatingWin=null
  4467. };
  4468. Klib.ClueFrame.floatingWin.closeIfNoOpener=function(){try{Klib.ClueFrame.floatingWin.setTimeout(Klib.ClueFrame.floatingWin.closeIfNoOpener,100)
  4469. }catch(E){this.close()
  4470. }};
  4471. Klib.ClueFrame.floatingWin.closeIfNoOpener();
  4472. if(Klib.isIE){Klib.ClueFrame.IEWindowChromeOffsetLeft=parseInt(Klib.ClueFrame.floatingWin.screenLeft-A);
  4473. Klib.ClueFrame.IEWindowChromeOffsetTop=parseInt(Klib.ClueFrame.floatingWin.screenTop-D)
  4474. }Klib.addEvent(Klib.ClueFrame.floatingWin,"resize",Klib.ClueFrame.saveSize);
  4475. Klib.ClueFrame.win=Klib.ClueFrame.floatingWin;
  4476. Klib.ClueFrame.doc=Klib.ClueFrame.floatingWin.document;
  4477. Klib.doWhen(Klib.ClueFrame.initClueFrame,"(Klib.ClueFrame.doc.body != null)")
  4478. }else{Klib.warning("Unable to create ClueFrame window, falling back to iframed mode");
  4479. Klib.ClueFrame.toggleFrameType()
  4480. }}};
  4481. Klib.ClueFrame.buildIFrame=function(F){Klib.LinkScent.getIconBlock(F);
  4482. Klib.MAX_Z_INDEX=Klib.isSafari?999999:2147483647;
  4483. if(!Klib.ClueFrame.building){if(!F||!F.body){return 
  4484. }Klib.ClueFrame.building=true;
  4485. try{var C=Klib.limit(Klib.Pref.get("ClueFrame.width"),Klib.ClueFrame.CLUEFRAME_MIN_WIDTH,Klib.ClueFrame.CLUEFRAME_MAX_WIDTH);
  4486. var B=Klib.limit(Klib.Pref.get("ClueFrame.height"),Klib.ClueFrame.CLUEFRAME_MIN_HEIGHT,Klib.ClueFrame.CLUEFRAME_MAX_HEIGHT);
  4487. var A=(Klib.isMoz)?"fixed":"absolute";
  4488. var D={display:"none",visibility:"visible",top:"-2000px",left:"-2000px",zIndex:Klib.MAX_Z_INDEX,width:"1px",height:"1px",position:A};
  4489. Klib.ClueFrame.iframe=Klib.Iframe.create("ClueFrame",F.body,true,{className:"clueframe",scrolling:"no"},D);
  4490. Klib.ClueFrame.iframe.isClueFrame=true;
  4491. Klib.ClueFrame.iframe.locked=false;
  4492. if(Klib.getStyle(Klib.ClueFrame.iframe,"position")!="fixed"){Klib.setStyle(Klib.ClueFrame.iframe,"position","absolute")
  4493. }Klib.setCSS(Klib.ClueFrame.iframe,Klib.getStyles("clueframe"));
  4494. if(Klib.isIE){Klib.makeEmbeddedWindowsTransparent(F);
  4495. Klib.Iframe.createShim(Klib.ClueFrame.iframe)
  4496. }Klib.ClueFrame.building=false;
  4497. Klib.Iframe.init(Klib.ClueFrame.iframe,Klib.ClueFrame.initClueFrame)
  4498. }catch(E){Klib.error(E,"Klib.ClueFrame.buildIFrame: failed to create iframe");
  4499. if(Klib.ClueFrame.iframe){Klib.ClueFrame.iframe=null
  4500. }}finally{Klib.ClueFrame.building=false
  4501. }}};
  4502. Klib.ClueFrame.getIframe=function(A){try{return Klib.ClueBridge.sourceDoc.getElementById("ClueFrame")
  4503. }catch(B){}try{return top.gBrowser.selectedBrowser.contentDocument.getElementById("ClueFrame")
  4504. }catch(B){}return false
  4505. };
  4506. Klib.ClueFrame.kill=function(){Klib.ClueFrame.hide(true);
  4507. if(Klib.ClueFrame.floatingWin){Klib.ClueFrame.floatingWin.close();
  4508. Klib.ClueFrame.floatingWin=null
  4509. }var A=Klib.ClueFrame.getIframe();
  4510. if(A){Klib.removeEle(A);
  4511. Klib.ClueFrame.iframe=null
  4512. }Klib.Clue.currentEle=null
  4513. };
  4514. Klib.ClueFrame.removeIframe=function(B){var A=B.getElementById("ClueFrame");
  4515. if(A){Klib.removeEle(A)
  4516. }};
  4517. Klib.ClueFrame.killUnusedFrames=function(){if(Klib.Global.get("loggedIn")){var B=Klib.Pref.get("ClueFrame.frameType");
  4518. if(Klib.ClueFrame.floatingWin&&Klib.ClueFrame.floatingWin.closeWin&&(B!="window")){Klib.ClueFrame.floatingWin.closeWin();
  4519. Klib.ClueFrame.floatingWin=null
  4520. }else{if(B!="iframe"){var A=Klib.ClueFrame.getIframe();
  4521. if(A){Klib.removeEle(A);
  4522. Klib.ClueFrame.iframe=null
  4523. }}}}else{Klib.ClueFrame.kill()
  4524. }};
  4525. Klib.ClueFrame.toggleFrameType=function(){var A=(Klib.Pref.get("ClueFrame.frameType")=="window")?"iframe":"window";
  4526. Klib.Pref.set("ClueFrame.frameType",A);
  4527. Klib.Clue.show();
  4528. Klib.ClueFrame.killUnusedFrames()
  4529. };
  4530. Klib.ClueFrame.saveLinkResponse=function(A){var C="";
  4531. var B="";
  4532. if(A.json&&!A.error){C=A.json.msg;
  4533. B=A.json.msgtype
  4534. }else{C=Klib.string("linktray.server.invalid.response");
  4535. B="error"
  4536. }if(A.useAlert){alert(C)
  4537. }else{Klib.ClueFrame.alert(C,"ClueFrame.saveLinkResponse",B)
  4538. }};
  4539. Klib.ClueFrame.alert=function(A,H,F,G,B,E,D,J){F=F||"message";
  4540. H=H||Klib.string("alert.default.title");
  4541. G=(G===undefined)?3000:G;
  4542. D=(D)?Klib.string("ok"):D;
  4543. Klib.ClueFrame.alert.origSize=null;
  4544. var I=Klib.ClueFrame.doc;
  4545. if(I&&Klib.ClueFrame.visible){$("alert-box",I).className="alert-"+F;
  4546. $("alert-title",I).innerHTML=H;
  4547. $("alert-message",I).innerHTML=A;
  4548. $("alert-dont-show-again-label",I).style.display=(J)?"":"none";
  4549. $("alert-dont-show-again",I).checked=false;
  4550. $("alert-button-ok",I).style.display=(B)?"":"none";
  4551. $("alert-button-cancel",I).style.display="none";
  4552. Klib.removeAllEvents($("alert-button-ok",I),"click");
  4553. Klib.removeAllEvents($("alert-button-cancel",I),"click");
  4554. Klib.removeAllEvents($("alert-close",I),"click");
  4555. Klib.removeAllEvents($("alert",I),"click");
  4556. if(E){Klib.addEvent($("alert-button-cancel",I),"click",function(){E();
  4557. Klib.ClueFrame.alertClose()
  4558. });
  4559. $("alert-button-cancel",I).style.display="none";
  4560. Klib.addEvent($("alert-close",I),"click",function(){E();
  4561. Klib.ClueFrame.alertClose()
  4562. })
  4563. }else{Klib.addEvent($("alert-close",I),"click",Klib.ClueFrame.alertClose)
  4564. }if(B){Klib.addEvent($("alert-button-ok",I),"click",function(){B();
  4565. Klib.ClueFrame.alertClose()
  4566. });
  4567. $("alert-button-ok",I).style.display=""
  4568. }else{if(J){}else{Klib.addEvent($("alert",I),"click",Klib.ClueFrame.alertClose)
  4569. }}if(D){$("alert-button-ok",I).value=D
  4570. }Klib.Pref.initDoc(I);
  4571. Klib.Toggle.initDoc(I);
  4572. $("alert",I).style.display="block";
  4573. var C=Klib.getRect($("alert-box",I));
  4574. Klib.ClueFrame.alert.origSize=Klib.ClueFrame.resizeToContent(true,C.width,C.bottom);
  4575. if($("alert-button-ok",I).style.display!="none"){$("alert-button-ok",I).focus()
  4576. }if(G&&(F!="error")&&(F!="confirm")){Klib.setTimer(Klib.ClueFrame.alertClose,G)
  4577. }}else{if(F=="confirm"){if(confirm(Klib.Html.toText(A))){onOK()
  4578. }else{onCancel()
  4579. }}else{alert(Klib.Html.toText(A))
  4580. }}};
  4581. Klib.ClueFrame.alertClose=function(){var A=Klib.ClueFrame.doc;
  4582. $("alert",A).style.display="none";
  4583. if(Klib.ClueFrame.alert.origSize){Klib.ClueFrame.restoreSize(Klib.ClueFrame.alert.origSize);
  4584. Klib.ClueFrame.alert.origSize=null
  4585. }};
  4586. Klib.ClueFrame.saveLink=function(A,C,D){var B=new Klib.Ajax.Obj(Klib.urls.bookmark);
  4587. B.onComplete=Klib.ClueFrame.saveLinkResponse;
  4588. B.isJson=true;
  4589. B.addData("uid",Klib.User.uid);
  4590. B.addData("url",Klib.getFixedHref(A));
  4591. B.addData("location",Klib.Clue.currentLocation);
  4592. B.useAlert=D;
  4593. if(C){B.addData("text",Klib.getSelectedText(C))
  4594. }if(C&&C.title){B.addData("title",C.title)
  4595. }B.send()
  4596. };
  4597. Klib.ClueFrame.initTitlebar=function(){var A=$("titlebar",Klib.ClueFrame.doc);
  4598. if(Klib.Pref.get("ClueFrame.frameType")=="iframe"){Klib.Drag.initEle(Klib.ClueFrame.iframe,A);
  4599. Klib.addEvent(Klib.ClueFrame.iframe,"dragfinish",function(){Klib.Tutorial.fireEvent(Klib.ClueFrame.iframe,"dragfinish")
  4600. })
  4601. }else{if((Klib.Pref.get("ClueFrame.frameType")=="window")&&(Klib.platform!="WinClues")){Klib.Drag.initWin(A)
  4602. }}};
  4603. Klib.ClueFrame.initButtons=function(){var E=Klib.ClueFrame.doc;
  4604. $("titlebar",E).innerHTML="";
  4605. $("toolbar",E).innerHTML="";
  4606. $("titlebar-right",E).innerHTML="";
  4607. Klib.ClueFrame.toolbarButtons=[];
  4608. for(var C=0;
  4609. C<Klib.ClueFrame.buttons.length;
  4610. C++){var A=Klib.ClueFrame.buttons[C];
  4611. var B=new Klib.Button(A);
  4612. B.baseClassName="toolbarbutton";
  4613. B.tooltip=Klib.translate(B.tooltip);
  4614. B.buttonCSS=Klib.styles["interclue-clueframe-button"];
  4615. var D=E.getElementById(A.location||"titlebar");
  4616. if(D){B.appendTo(D,true)
  4617. }else{Klib.warning("failed to find toolbar",A.id,A.location)
  4618. }if(A.init){A.init()
  4619. }Klib.ClueFrame.toolbarButtons[C]=B
  4620. }if(Klib.Pref.get("CustomButtons.enabled")){Klib.CustomButtons.init();
  4621. Klib.ClueFrame.customButtons={};
  4622. var D=E.getElementById("titlebar");
  4623. for(var F in Klib.CustomButtons.items){Klib.ClueFrame.customButtons[F]=Klib.CustomButtons.items[F].build(D)
  4624. }}Klib.ClueFrame.refreshButtons()
  4625. };
  4626. Klib.ClueFrame.refreshButtons=function(){for(var B=0;
  4627. B<Klib.ClueFrame.toolbarButtons.length;
  4628. B++){var A=Klib.ClueFrame.toolbarButtons[B];
  4629. var D="Button."+(A.groupId?A.groupId:A.id)+".showInTitlebar";
  4630. if(Klib.Pref.get(D,false)){if(A.getVisibility){var C=A.getVisibility(Klib.Clue.currentClue);
  4631. switch(C){case"visible":A.enable();
  4632. break;
  4633. case"disabled":A.enable();
  4634. break;
  4635. case"hidden":A.hide();
  4636. break;
  4637. default:Klib.error("Invalid response from btn.getVisibility()",A.id,C)
  4638. }}else{if(A.enabled(Klib.Clue.currentClue)){A.enable()
  4639. }else{if(A.spriteDisabled){A.enable()
  4640. }else{A.hide()
  4641. }}}}else{A.hide()
  4642. }}for(var E in Klib.ClueFrame.customButtons){var A=Klib.ClueFrame.customButtons[E];
  4643. var D="CustomButton."+(A.id)+".enabled";
  4644. if(Klib.Pref.get(D,true)){if(A.isDisabled()){A.disable()
  4645. }else{A.enable()
  4646. }}else{A.hide()
  4647. }}};
  4648. Klib.rectInRect=function(B,A){return(Klib.pointInRect({x:B.left,y:B.top},A)||Klib.pointInRect({x:B.left,y:B.bottom},A)||Klib.pointInRect({x:B.right,y:B.top},A)||Klib.pointInRect({x:B.right,y:B.bottom},A)||Klib.pointInRect({x:A.left,y:A.top},B)||Klib.pointInRect({x:A.left,y:A.bottom},B)||Klib.pointInRect({x:A.right,y:A.top},B)||Klib.pointInRect({x:A.right,y:A.bottom},B))
  4649. };
  4650. Klib.pointInRect=function(B,A){return((B.x>=A.left)&&(B.x<=A.right)&&(B.y>=A.top)&&(B.y<=A.bottom))
  4651. };
  4652. Klib.ClueFrame.handleContentClick=function(A){var B=Klib.getParent(A.target,"a",true);
  4653. if(B&&B.href&&B.href.match(/http(s)?:/)){var C="";
  4654. if(A.mouseButton==1){C=Klib.Pref.get("ClueFrame.linkTargetClick")
  4655. }if(A.mouseButton==4){C=Klib.Pref.get("ClueFrame.linkTargetMiddleClick")
  4656. }if(C=="clue"){if((Klib.findParent(B,function(D){return(Klib.hasClass(D,"interclue-open-link-in-clueframe"))
  4657. },true)!=null)&&(Klib.findParent(B,function(D){return(Klib.hasClass(D,"interclue-dont-open-link-in-clueframe"))
  4658. },true)==null)){}else{if(A.mouseButton==1){C="current"
  4659. }else{C="background"
  4660. }}}switch(C){case"clue":Klib.ClueFrame.showUrl(B.href,Klib.innerText(B));
  4661. A.halt();
  4662. break;
  4663. case"current":Klib.ClueBridge.openUrl(B.href);
  4664. A.halt();
  4665. break;
  4666. case"background":Klib.ClueBridge.openUrl(B.href,true);
  4667. A.halt();
  4668. break;
  4669. case"foreground":Klib.ClueBridge.openUrl(B.href,true,true);
  4670. A.halt();
  4671. break;
  4672. default:break
  4673. }}return true
  4674. };
  4675. Klib.ClueFrame.lastMouseMoveEvent=null;
  4676. Klib.ClueFrame.handleMouseHover=function(A){if(A&&A.currTarget){var C=A.currTarget;
  4677. if(!C.tagName&&!C.parentNode){Klib.error("ClueFrame.handleMouseMove",C)
  4678. }else{if(!C.tagName&&C.parentNode){C=C.parentNode
  4679. }}while(C&&C.getAttribute&&C.parentNode){if(C.id=="interclue-tooltip-box"){return 
  4680. }var B=C.getAttribute("tooltip");
  4681. if(B){Klib.ClueFrame.showTooltip(B,A.docX,A.docY);
  4682. return 
  4683. }C=C.parentNode
  4684. }}Klib.ClueFrame.hideTooltip()
  4685. };
  4686. Klib.ClueFrame.handleMouseMove=function(A){Klib.ClueFrame.lastMouseMoveEvent=A;
  4687. Klib.setNamedTimer("ClueFrame.handleMouseHover",Klib.ClueFrame.handleMouseHover,250)
  4688. };
  4689. Klib.ClueFrame.showTooltip=function(C,B,G){var D=Klib.ClueFrame.contentFrame.doc;
  4690. if(D){var F=$("interclue-tooltip-box",D);
  4691. if(!F){F=D.createElement("div");
  4692. F.setAttribute("id","interclue-tooltip-box");
  4693. D.body.appendChild(F)
  4694. }if(!F.lastTip||F.lastTip!=C){Klib.setStyle(F,"left","-2000px");
  4695. Klib.setStyle(F,"top","0px");
  4696. F.visible=false;
  4697. F.lastTip=C;
  4698. F.innerHTML=C
  4699. }if(!F.visible){Klib.setStyle(F,"display","block");
  4700. F.rect=Klib.getRect(F);
  4701. var E=Klib.getRect(D.body);
  4702. var A=Klib.ClueFrame.getViewPortRect(D);
  4703. F.rect.setLeft(B-(F.rect.width+10));
  4704. F.rect.setTop(G-(F.rect.height+10));
  4705. F.rect=Klib.rectFitInRect(F.rect,A);
  4706. if(F.rect){Klib.setStyle(F,"left",F.rect.left+"px");
  4707. Klib.setStyle(F,"top",F.rect.top+"px");
  4708. F.visible=true
  4709. }}}else{Klib.error("contentFrame document not ready to show tooltip")
  4710. }};
  4711. Klib.ClueFrame.hideTooltip=function(){var B;
  4712. try{B=Klib.ClueFrame.contentFrame.doc
  4713. }catch(A){}if(B){var C=$("interclue-tooltip-box",B);
  4714. if(!C){return 
  4715. }Klib.setStyle(C,"left","-2000px");
  4716. Klib.setStyle(C,"top","0px");
  4717. C.visible=false
  4718. }};
  4719. Klib.ClueFrame.initContentFrameDoc=function(){var C=Klib.ClueFrame.contentFrame.doc;
  4720. var B=Klib.ClueFrame.contentFrame.win;
  4721. try{C.getElementsByTagName("html")[0].className="interclue-clueview-content"
  4722. }catch(A){Klib.error("Failed to set classname on contentframe")
  4723. }Klib.insertStyleSheet("clueContent.css",C);
  4724. Klib.addEvent(C,"click",Klib.ClueFrame.handleContentClick);
  4725. Klib.addEvent(C,"mouseover",Klib.ClueFrame.stopHideTimer);
  4726. Klib.addEvent(B,"focus",Klib.ClueFrame.handleFocus);
  4727. Klib.Hover.addHover(C.body,Klib.ClueFrame.handleMouseHover,250);
  4728. Klib.addEvent(C,"mouseover",Klib.ClueFrame.setFocusToClueFrame);
  4729. if(Klib.isIE){Klib.addEvent(C,"mousewheel",Klib.ClueFrame.handleMouseWheelIE)
  4730. }Klib.Mouse.initDoc(C);
  4731. Klib.Key.initDoc(C);
  4732. Klib.ClueFrame.setContentFont();
  4733. Klib.ClueFrame.setContentFontSize()
  4734. };
  4735. Klib.ClueFrame.initContentFrame=function(){var A=Klib.ClueFrame.doc.getElementById("content");
  4736. Klib.ClueFrame.iframe.contentFrame=Klib.Iframe.create("contentFrame",A,false);
  4737. Klib.ClueFrame.contentFrame=Klib.ClueFrame.iframe.contentFrame;
  4738. Klib.Iframe.init(Klib.ClueFrame.contentFrame,Klib.ClueFrame.initContentFrameDoc)
  4739. };
  4740. Klib.ClueFrame.lastHTML="";
  4741. Klib.ClueFrame.contentHTML="";
  4742. Klib.ClueFrame.reinitContentFrameDoc=function(){Klib.addEvent(Klib.ClueFrame.contentFrame.doc,"click",Klib.ClueFrame.handleContentClick);
  4743. Klib.addEvent(Klib.ClueFrame.contentFrame.doc,"mouseover",Klib.ClueFrame.stopHideTimer)
  4744. };
  4745. Klib.ClueFrame.renderButtonImage=function(A){return Klib.sprites[A.sprite].getHTML()
  4746. };
  4747. Klib.ClueFrame.renderButtonsTable=function(){var F='<table class="datatable" cellpadding="0" cellspacing="0" width="100%">            <col width="25" /><col width="100%" align="left" /><col width="60" /><col width="60" />            <tr class="thead"><th> </th><th align="left">'+Klib.string("clueframe.buttontable.buttons")+"</th><th>"+Klib.string("clueframe.buttontable.title.toolbar")+"</th></tr>";
  4748. var G=true;
  4749. for(var E=0;
  4750. E<Klib.ClueFrame.buttons.length;
  4751. E++){var D=Klib.ClueFrame.buttons[E];
  4752. if(!D.locked){var B=(G?"odd":"even");
  4753. var A="";
  4754. if(D.url){var C=D.urlText?D.urlText:D.url;
  4755. A='   (<a href="'+Klib.htmlspecialchars(D.url)+'">'+Klib.htmlspecialchars(C)+"</a>)"
  4756. }if(D.groupDescription){F+='<tr class="'+B+'">                        <td>'+Klib.sprites[D.sprite].getHTML()+'</td>                        <td style="text-align: left">'+D.groupDescription+'</td>                        <td><input id="Button.'+D.id+'.showInTitlebar" preferenceid="Button.'+D.groupId+'.showInTitlebar" type="checkbox" datatype="bool" /></td>                    </tr>';
  4757. G=!G
  4758. }else{if(!D.groupId){F+='<tr class="'+B+'">                        <td>'+Klib.sprites[D.sprite].getHTML()+'</td>                        <td style="text-align: left">'+D.tooltip+A+'</td>                        <td><input id="Button.'+D.id+'.showInTitlebar" preferenceid="Button.'+D.id+'.showInTitlebar" type="checkbox" datatype="bool" /></td>                    </tr>';
  4759. G=!G
  4760. }}}}F+="</table>";
  4761. return F
  4762. };
  4763. Klib.ClueFrame.setRefreshFlag=function(){var A=Klib.ClueFrame.contentFrame.doc;
  4764. if(A){A.lastHTML=""
  4765. }};
  4766. Klib.ClueFrame.setContent=function(A,E){if(Klib.ClueFrame.contentFrame&&Klib.ClueFrame.contentFrame.win&&Klib.ClueFrame.contentFrame.doc&&Klib.ClueFrame.contentFrame.doc.body){var D=Klib.ClueFrame.contentFrame.doc;
  4767. var C=Klib.ClueFrame.contentFrame.win;
  4768. Klib.ClueFrame.hideLoading();
  4769. C.handle3rdPartyFrameLoad=(E&&E.initFramedContent)?Klib.ClueFrame.handle3rdPartyFrameLoad:function(){};
  4770. D.lastHTML=D.lastHTML||"";
  4771. if(A==""||D.lastHTML!=A){D.body.scrollTop=0;
  4772. D.lastHTML=A;
  4773. D.body.innerHTML="";
  4774. Klib.insertStyleSheet("clueContent.css",D);
  4775. Klib.ClueFrame.setContentFont();
  4776. D.body.innerHTML+=A;
  4777. if(E){var B=Klib.ClueFrame.getIframe();
  4778. if(E.link&&E.link.href&&B){B.currentURL=Klib.getFixedHref(E.link);
  4779. B.currentLink=E.link
  4780. }if(E.state==Klib.Clue.STATE_COMPLETE){Klib.Clue.currVisibleClueEle=E.link;
  4781. Klib.ClueFrame.getHistory().addItem(E.link);
  4782. Klib.ClueFrame.refreshButtons()
  4783. }if(E.initContent){E.initContent(D,E)
  4784. }if(Klib.Pref.get("ClueFrame.showCluescriptId")){Klib.ClueFrame.status(E.id)
  4785. }Klib.Pref.initDoc(D);
  4786. Klib.BugReporter.initDocLinks(D);
  4787. Klib.Toggle.initDoc(D);
  4788. Klib.Content.initDoc(D,E);
  4789. Klib.Clue.initContentDoc(D,E);
  4790. if(E.state==Klib.Clue.STATE_COMPLETE&&Klib.Pref.get("Summary.images")){Klib.Content.enableImagesInSummaries(D,E)
  4791. }if(E.group=="summary"&&E.state==Klib.Clue.STATE_COMPLETE){Klib.Stats.viewClue(E);
  4792. if(Klib.Pref.get("Clue.prefetchSimilarLinks")){Klib.LinkScent.prefetchSimilarLinks(E.link)
  4793. }}}}if(E&&E.onDisplayClue){E.onDisplayClue(E)
  4794. }}else{Klib.setNamedTimer("setContent",function(){Klib.ClueFrame.setContent(A,E)
  4795. },100)
  4796. }};
  4797. Klib.ClueFrame.calculateBestClue=function(B){for(var A=0;
  4798. A<Klib.Clue.current.length;
  4799. A++){var C=Klib.Clue.current[A];
  4800. if(C.enabled&&C.visible){return C
  4801. }}return false
  4802. };
  4803. Klib.ClueFrame.forceRefresh=function(){var C=Klib.ClueFrame.getCurrentLink();
  4804. if(C){Klib.LinkScent.cleanupLink(C);
  4805. Klib.LinkScent.clueIconCache.remove(Klib.getFixedHref(C));
  4806. Klib.Clue.cleanupLink(C);
  4807. var A=Klib.getFixedHref(C).replace(/#.*$/,"");
  4808. Klib.HTMLDoc.cache.remove(A);
  4809. Klib.Clue.initLink(C);
  4810. Klib.LinkScent.initLink(C,true);
  4811. var B=Klib.ClueFrame.getIframe();
  4812. if(B){B.lastErrorLink=null
  4813. }Klib.ClueFrame.showLoading();
  4814. Klib.ClueFrame.displayClue.lastLink=null;
  4815. Klib.ClueFrame.startTimeoutTimer(C);
  4816. C.linkscent.forceRefresh=true;
  4817. Klib.LinkScent.fetchLink(C,true);
  4818. Klib.Clue.currentClue=null;
  4819. Klib.LinkScent.showLinkscents(C)
  4820. }};
  4821. Klib.ClueFrame.isClueFrameDoc=function(B){var A=Klib.ClueFrame.getIframe();
  4822. if(!A){return false
  4823. }if(B==A.doc){return true
  4824. }else{if(Klib.ClueFrame.contentFrame&&B==Klib.ClueFrame.contentFrame.doc){return true
  4825. }else{return false
  4826. }}};
  4827. Klib.ClueFrame.getLoadingHTML=function(){return'<div class="interclue-clue-loading"><div id="interclue-clueframe-loading">'+Klib.string("clueframe.loading")+"</div></div>"
  4828. };
  4829. Klib.ClueFrame.showLoading=function(B){var A=Klib.ClueFrame.getIframe();
  4830. if(A&&A.doc){Klib.setStyle($("interclue-loading-overlay",A.doc),"display","block")
  4831. }if(B){Klib.setNamedTimer("Klib.ClueFrame.showLoading",B,2000)
  4832. }};
  4833. Klib.ClueFrame.isLoading=function(){var B=Klib.ClueFrame.getIframe();
  4834. if(B&&B.doc){var A=$("interclue-loading-overlay",B.doc);
  4835. return(A&&Klib.getStyle(A,"display")=="block")
  4836. }return false
  4837. };
  4838. Klib.ClueFrame.hideLoading=function(){var A=Klib.ClueFrame.getIframe();
  4839. if(A&&A.doc){var B=$("interclue-loading-overlay",A.doc);
  4840. if(B){Klib.setStyle(B,"display","none")
  4841. }}};
  4842. Klib.ClueFrame.showLoadingError=function(C){var B=Klib.ClueFrame.getIframe();
  4843. if(B&&Klib.Clue.currentEle&&Klib.Clue.currentEle==C&&Klib.ClueFrame.isLoading()){B.lastErrorLink=C;
  4844. var A=C.linkscent.htmldoc||new Klib.HTMLDoc.Obj(Klib.getFixedHref(C));
  4845. A.halt();
  4846. A.status=Klib.Ajax.REQUEST_TIMED_OUT;
  4847. A.statusText="Timed Out";
  4848. A.error=true;
  4849. var D=Klib.Clue.getClue("fileNotFound");
  4850. D.setLink(C);
  4851. D.htmldoc=A;
  4852. Klib.Clue.currentClue=D;
  4853. D.setState(Klib.Clue.STATE_COMPLETE);
  4854. D.extractContentFailed=false;
  4855. D.updateContent();
  4856. Klib.ClueFrame.setContent(D.content,D)
  4857. }};
  4858. Klib.ClueFrame.startTimeoutTimer=function(A){if(A&&A.href&&Klib.ClueFrame.displayClue.lastLink!=A){Klib.ClueFrame.displayClue.lastLink=A;
  4859. Klib.setNamedTimer("Klib.ClueFrame.showLoadingError",function(){Klib.ClueFrame.showLoadingError(A)
  4860. },(Klib.Pref.get("ClueScript.defaultTimeout")*1000))
  4861. }};
  4862. Klib.ClueFrame.displayClue=function(E){var D=Klib.Clue.currentEle;
  4863. var B=Klib.ClueFrame.getIframe();
  4864. if(D&&B&&B.lastErrorLink==D){B.lastErrorLink=null;
  4865. return 
  4866. }else{if(B){B.lastErrorLink=null
  4867. }}if(D&&D.linkscent&&(D.linkscent.isSafe===false)){E=Klib.Clue.getClue("unsafeUrl")
  4868. }E=E||Klib.ClueFrame.calculateBestClue(Klib.Clue.currentEle);
  4869. if(!E){Klib.error("Klib.ClueFrame.displayClue","No clues are enabled!");
  4870. return 
  4871. }Klib.ClueFrame.startTimeoutTimer(D);
  4872. if(E.id!="unsafeUrl"&&!E.staticContent){var A=(D&&D.href)?Klib.HTMLDoc.get(Klib.getFixedHref(D)):null;
  4873. if(A){var C=function(){Klib.ClueFrame.displayClue(E)
  4874. };
  4875. if(!E.externalContent){switch(A.state){case Klib.HTMLDoc.STATE_RETRIEVING_HEADERS:case Klib.HTMLDoc.STATE_RETRIEVING_BODY:case Klib.HTMLDoc.STATE_PARSING:Klib.ClueFrame.showLoading(C);
  4876. return ;
  4877. case Klib.HTMLDoc.STATE_COMPLETE:case Klib.HTMLDoc.STATE_ERROR:break;
  4878. case Klib.HTMLDoc.STATE_INIT:case Klib.HTMLDoc.STATE_INCOMPLETE:Klib.ClueFrame.showLoading(C);
  4879. A.addEvent("complete",C);
  4880. A.fetchContent=true;
  4881. A.parseHTML=true;
  4882. A.fetch();
  4883. return ;
  4884. default:Klib.error("Invalid htmldoc state");
  4885. return 
  4886. }}}}if((Klib.Clue.currentClue!=E)||(Klib.Clue.lastEle!=Klib.Clue.currentEle)||(D&&D.linkscent.forceRefresh)){if(Klib.Clue.lastClue!=Klib.Clue.currentClue){Klib.Clue.lastClue=Klib.Clue.currentClue
  4887. }Klib.Clue.currentClue=E;
  4888. Klib.Clue.lastEle=Klib.Clue.currentEle;
  4889. E.setLink(Klib.Clue.currentEle);
  4890. Klib.selectNone(Klib.ClueFrame.doc);
  4891. Klib.ClueFrame.refreshButtons();
  4892. Klib.ClueFrame.updateContent(E);
  4893. if(D){E.getContent("force",D.linkscent.forceRefresh?true:false);
  4894. D.linkscent.forceRefresh=false
  4895. }}else{Klib.ClueFrame.setRefreshFlag();
  4896. Klib.ClueFrame.updateContent(E)
  4897. }if(E.onDisplayClue){E.onDisplayClue(E)
  4898. }};
  4899. Klib.ClueFrame.status=function(C,A){A=A||3000;
  4900. var B=$("statusbar",Klib.ClueFrame.doc);
  4901. if(!B){return 
  4902. }B.innerHTML=C;
  4903. if(A>0){Klib.setNamedTimer("Klib.ClueFrame.status",Klib.ClueFrame.clearStatus,A)
  4904. }else{Klib.clearTimer("Klib.ClueFrame.status")
  4905. }};
  4906. Klib.ClueFrame.clearStatus=function(){Klib.ClueFrame.status(Klib.string("clueframe.status.default"))
  4907. };
  4908. Klib.ClueFrame.getNextClueInGroup=function(A){var C=false;
  4909. for(var B=0;
  4910. B<Klib.Clue.current.length;
  4911. B++){var D=Klib.Clue.current[B];
  4912. if(C&&D.enabled&&D.visible&&(D.group==A.group)){return D
  4913. }if(D==A){C=true
  4914. }}return false
  4915. };
  4916. Klib.ClueFrame.updateContent=function(E){if(E==Klib.Clue.currentClue){if(E.extractContentFailed&&E.group){var D=Klib.ClueFrame.getNextClueInGroup(E);
  4917. if(D){E.link.linkscent.failover=true;
  4918. Klib.ClueFrame.displayClue(D);
  4919. E.link.linkscent.failover=false;
  4920. return 
  4921. }else{if(Klib.Pref.get("QFS.enabled")&&E.QFS){Klib.Summary.reportBadSummary(false)
  4922. }else{}}}else{var C=E.content;
  4923. var B=Klib.ClueFrame.getLoadingHTML();
  4924. var A='<div class="interclue-clue-error"></div>';
  4925. switch(E.state){case Klib.Clue.STATE_LOADED:case Klib.Clue.STATE_LOADING:Klib.ClueFrame.status(Klib.string("clueframe.status.loading"));
  4926. Klib.ClueFrame.showLoading();
  4927. return ;
  4928. case Klib.Clue.STATE_RETRIEVING:Klib.ClueFrame.status(Klib.string("clueframe.status.retrieving"));
  4929. Klib.ClueFrame.showLoading();
  4930. return ;
  4931. case Klib.Clue.STATE_PARSING:Klib.ClueFrame.status(Klib.string("clueframe.status.parsing"));
  4932. Klib.ClueFrame.showLoading();
  4933. return ;
  4934. case Klib.Clue.STATE_ERROR:Klib.ClueFrame.status(E.id+":"+Klib.string("clueframe.status.error")+" "+E.subs.status+":"+E.subs.statusText);
  4935. if(E.error){C=E.error
  4936. }else{C=Klib.string("clue.error.generic",E.subs.status,E.subs.statusText,E.subs.contentUrl)
  4937. }break;
  4938. case Klib.Clue.STATE_COMPLETE:Klib.ClueFrame.status(Klib.string("clueframe.status.done"));
  4939. break;
  4940. default:break
  4941. }Klib.ClueFrame.setContent(C,E)
  4942. }}else{}};
  4943. Klib.ClueFrame.show=function(){if(Klib.isFirefox3&&Klib.geckoBuild<20080529&&top.interclue.getCurrentDocZoomLevel()!=1){var A=top.document.getElementById("interclue-tooltip-zoom-bug");
  4944. if(A.state=="closed"){A.openPopupAtScreen(Klib.Mouse.screenX,Klib.Mouse.screenY,false);
  4945. A.timerHide=setInterval(function(){if(A&&!A.mouseOver){clearInterval(A.timerHide);
  4946. A.hidePopup()
  4947. }},3000)
  4948. }Klib.ClueFrame.hide();
  4949. return 
  4950. }Klib.ClueFrame.alertClose();
  4951. if(Klib.Pref.get("ClueFrame.frameType")=="iframe"){Klib.setStyle(Klib.ClueFrame.iframe,"display","block");
  4952. Klib.ClueFrame.visible=true
  4953. }};
  4954. Klib.ClueFrame.currFocus=false;
  4955. Klib.ClueFrame.handleFocus=function(){Klib.ClueFrame.currFocus=true
  4956. };
  4957. Klib.ClueFrame.handleBlur=function(){Klib.ClueFrame.currFocus=false
  4958. };
  4959. Klib.ClueFrame.forceHide=function(){Klib.ClueFrame.hide(true)
  4960. };
  4961. Klib.ClueFrame.hide=function(E){var C=Klib.ClueFrame.getIframe();
  4962. if((E===true)||((C&&!C.locked)&&!Klib.Drag.dragging&&!Klib.Clue.hotKeysPressed)){Klib.ClueFrame.visible=false;
  4963. if(C){C.positionBeforeResize=null
  4964. }Klib.selectNone(Klib.ClueFrame.doc);
  4965. Klib.ClueFrame.setContent("");
  4966. if(Klib.ClueFrame.currFocus&&Klib.ClueBridge.sourceWin){}Klib.ClueFrame.currFocus=false;
  4967. Klib.Tutorial.fireEvent(Klib.Clue.currentEle,"clueframeHide");
  4968. var F=(Klib.Clue.currentEle)?Klib.getDoc(Klib.Clue.currentEle):(C?Klib.getDoc(C):Klib.Clue.currentDoc);
  4969. if(C){C.lastErrorLink=null
  4970. }Klib.Clue.currentEle=null;
  4971. Klib.Clue.currVisibleClueEle=null;
  4972. Klib.Clue.hoverLink=null;
  4973. if(F){Klib.LinkScent.fadeDocLinkscents(F)
  4974. }if(Klib.Clue.currentClue&&Klib.Clue.currentClue.removeOnHide){Klib.ClueFrame.setContent("")
  4975. }var D=$("statusbar",Klib.ClueFrame.doc);
  4976. if(D){D.lastMessageImportant=false
  4977. }if(Klib.Pref.get("ClueFrame.frameType")=="iframe"&&C){if(C.locked){Klib.ClueFrame.toggleLocked()
  4978. }C.locked=false;
  4979. C.style.left="-2000px";
  4980. var B=C.offsetLeft;
  4981. Klib.setStyle(C,"width",Klib.Pref.get("ClueFrame.width")+"px");
  4982. Klib.setStyle(C,"height",Klib.Pref.get("ClueFrame.height")+"px");
  4983. C.style.display="none"
  4984. }else{if(Klib.Pref.get("ClueFrame.frameType")=="window"&&Klib.windowExists(Klib.ClueFrame.win)){if(Klib.isIE){Klib.ClueFrame.win.blur();
  4985. Klib.ClueBridge.sourceWin.focus()
  4986. }if(Klib.platform=="siteclues"||Klib.platform=="IEToolbar"){var A=Klib.getRect(window);
  4987. Klib.ClueFrame.win.moveTo(A.left,A.top);
  4988. Klib.ClueBridge.sourceWin.focus()
  4989. }else{Klib.ClueFrame.win.moveTo(0-screen.width,0-screen.height)
  4990. }}}Klib.clearTimer("CustomButtonIframeMessageWatcher")
  4991. }};
  4992. Klib.ClueFrame.showCurrentLink=function(D){Klib.ClueFrame.stopHideTimer();
  4993. var B=Klib.Clue.currentEle;
  4994. for(var A=0;
  4995. A<Klib.Clue.current.length;
  4996. A++){var C=Klib.Clue.current[A];
  4997. if(C.enabled&&C.isValidLink(B)){C.setLink(B,D);
  4998. C.visible=!C.linkscentOnly
  4999. }else{C.visible=false
  5000. }}Klib.ClueFrame.scrollIntoView(B);
  5001. Klib.ClueFrame.show();
  5002. Klib.ClueFrame.displayClue()
  5003. };
  5004. Klib.ClueFrame.scrollIntoView=function(C){var B=Klib.getBox(C);
  5005. var A=Klib.getWinRect(Klib.getWin(C));
  5006. if(B.width==0&&B.height==0){return false
  5007. }else{if(B.screenY>=A.top&&(B.screenY+B.height)<=A.bottom){return false
  5008. }else{if(B.screenY<A.top){C.scrollIntoView(true);
  5009. return true
  5010. }else{C.scrollIntoView(false);
  5011. return true
  5012. }}}};
  5013. Klib.ClueFrame.handleResizerDrag=function(D){var C=(D.screenX-Klib.Drag.startScreenX);
  5014. var A=(D.screenY-Klib.Drag.startScreenY);
  5015. var E=Klib.ClueFrame.startWidth+C;
  5016. var B=Klib.ClueFrame.startHeight+A;
  5017. E=Klib.limit(E,Klib.ClueFrame.CLUEFRAME_MIN_WIDTH,Klib.ClueFrame.CLUEFRAME_MAX_WIDTH);
  5018. B=Klib.limit(B,Klib.ClueFrame.CLUEFRAME_MIN_HEIGHT,Klib.ClueFrame.CLUEFRAME_MAX_HEIGHT);
  5019. Klib.setStyle(Klib.ClueFrame.iframe,"width",E+"px");
  5020. Klib.setStyle(Klib.ClueFrame.iframe,"height",B+"px")
  5021. };
  5022. Klib.ClueFrame.handleResizerDragStart=function(A){Klib.ClueFrame.startWidth=Klib.ClueFrame.iframe.clientWidth;
  5023. Klib.ClueFrame.startHeight=Klib.ClueFrame.iframe.clientHeight;
  5024. Klib.ClueFrame.iframe.positionBeforeResize=null
  5025. };
  5026. Klib.ClueFrame.initStatusBar=function(){var A=Klib.ClueFrame.doc.getElementById("resizehandle");
  5027. A.dragDontMove=true;
  5028. Klib.Drag.initEle(A,null,Klib.ClueFrame.win);
  5029. Klib.addEvent(A,"dragbegin",Klib.ClueFrame.handleResizerDragStart);
  5030. Klib.addEvent(A,"dragging",Klib.ClueFrame.handleResizerDrag);
  5031. Klib.addEvent(A,"dragfinish",Klib.ClueFrame.saveSize);
  5032. Klib.addEvent(A,"dragfinish",function(){Klib.Tutorial.fireEvent(Klib.ClueFrame.iframe,"resize")
  5033. })
  5034. };
  5035. Klib.ClueFrame.mouseNearClueFrame=function(B){var E={x:B.screenX,y:B.screenY};
  5036. var C;
  5037. if((Klib.Pref.get("ClueFrame.frameType")=="iframe")&&Klib.ClueFrame.iframe){C=Klib.getRect(Klib.ClueFrame.iframe);
  5038. if(Klib.getStyle(Klib.ClueFrame.iframe,"position")=="fixed"){var A=Klib.getDocScroll(Klib.getDoc(Klib.ClueFrame.iframe));
  5039. C.setLeft(C.left+A.left);
  5040. C.setTop(C.top+A.top)
  5041. }C.setLeft(C.left+(B.screenX-B.docX));
  5042. C.setTop(C.top+(B.screenY-B.docY))
  5043. }else{if((Klib.Pref.get("ClueFrame.frameType")=="window")&&Klib.ClueFrame.floatingWin){C=Klib.getRect(Klib.ClueFrame.floatingWin)
  5044. }else{return false
  5045. }}var D=Klib.Pref.getInt("ClueFrame.frameMargin",10);
  5046. C.expand(D);
  5047. return Klib.pointInRect(E,C)
  5048. };
  5049. Klib.ClueFrame.showClue=function(A,B){Klib.LinkScent.initLink(A);
  5050. Klib.LinkScent.currentLink=A;
  5051. Klib.LinkScent.showCurrentLinksLinkscents(true);
  5052. Klib.Clue.currentEle=A;
  5053. Klib.LinkScent.haltOtherRequests(Klib.getFixedHref(A));
  5054. if(Klib.LinkScent.shouldPrefetchLink(A)){Klib.LinkScent.fetchLink(A)
  5055. }Klib.ClueFrame.checkFrame(A);
  5056. if(B){Klib.ClueFrame.positionFrame(A)
  5057. }Klib.ClueFrame.showCurrentLink()
  5058. };
  5059. Klib.ClueFrame.showPrevLink=function(){if(Klib.Clue.currentClue&&Klib.Clue.currentClue.link){var A=Klib.Clue.currentClue.link;
  5060. var C=A.ownerDocument;
  5061. if(C){for(var B=0;
  5062. B<C.links.length;
  5063. B++){if(A==C.links[B]){if(B>0){Klib.ClueFrame.showClue(C.links[B-1])
  5064. }else{Klib.ClueFrame.alert("First link on page")
  5065. }return 
  5066. }}Klib.ClueFrame.alert("Unable to find link in document","ShowPrevLink:Error","error");
  5067. Klib.warning("Unable to find link in document")
  5068. }else{Klib.ClueFrame.alert("Unable to find document for link","ShowPrevLink:Error","error");
  5069. Klib.warning("Unable to find doc for link",A)
  5070. }}};
  5071. Klib.ClueFrame.getFirstTextNode=function(C){if(C.childNodes&&C.childNodes.length){for(var B=0;
  5072. B<C.childNodes.length;
  5073. B++){var E=C.childNodes[B];
  5074. var D=/\S+/;
  5075. if(E.nodeType==Klib.NODE_TYPE_TEXT&&E.data&&D.test(E.data)){return E
  5076. }else{if(E.nodeType==Klib.NODE_TYPE_ELEMENT){var A=Klib.ClueFrame.getFirstTextNode(E);
  5077. if(A){return A
  5078. }}}}}return null
  5079. };
  5080. Klib.ClueFrame.isSimilarLink=function(C,B){if(C.protocol!="javascript:"&&B.protocol=="javascript:"){return false
  5081. }var E=Klib.ClueFrame.getFirstTextNode(C);
  5082. var D=Klib.ClueFrame.getFirstTextNode(B);
  5083. if(E&&D){var A=E.parentNode;
  5084. var F=D.parentNode;
  5085. return(Klib.getStyle(A,"fontSize")==Klib.getStyle(F,"fontSize"))&&(Klib.getStyle(A,"fontFamily")==Klib.getStyle(F,"fontFamily"))&&(Klib.getStyle(A,"fontStyle")==Klib.getStyle(F,"fontStyle"))
  5086. }else{return false
  5087. }};
  5088. Klib.ClueFrame.getNextSimilarLink=function(C,D){D=(D===-1)?-1:1;
  5089. var N=10;
  5090. var P=C.ownerDocument.links;
  5091. var B=null;
  5092. var G=null;
  5093. var H=-1;
  5094. var M=null;
  5095. var J=Klib.Clue.isInternalLink(C);
  5096. for(var I=0;
  5097. I<P.length;
  5098. I++){if(P[I]==C){G=I;
  5099. break
  5100. }}if(G!==null){var L=G;
  5101. var E=Klib.getRect(C);
  5102. while(1){L+=D;
  5103. if(L>=0&&L<P.length){var O=P[L];
  5104. if(Klib.ClueFrame.isSimilarLink(C,O)){var F=Klib.getUrlFromLink(C);
  5105. var K=Klib.getUrlFromLink(O);
  5106. if(F.anchor&&K.anchor&&(F.domain==K.domain)){return O
  5107. }var A=Klib.getRect(O);
  5108. if(A.left==E.left){return O
  5109. }else{if(B&&(Math.abs(H-L)>N)){break
  5110. }else{if(!B){H=L;
  5111. B=O
  5112. }}}}}else{break
  5113. }}if(B){return B
  5114. }else{return null
  5115. }}else{return null
  5116. }};
  5117. Klib.ClueFrame.showLinkNext=function(){if(Klib.ClueFrame.isVisible()&&Klib.ClueFrame.isLocked()){Klib.ClueFrame.showNextLink(+1)
  5118. }};
  5119. Klib.ClueFrame.showLinkPrev=function(){if(Klib.ClueFrame.isVisible()&&Klib.ClueFrame.isLocked()){Klib.ClueFrame.showNextLink(-1)
  5120. }};
  5121. Klib.ClueFrame.showLinkNextSimilar=function(){if(Klib.ClueFrame.isVisible()&&Klib.ClueFrame.isLocked()){Klib.ClueFrame.showNextLink(+1,true)
  5122. }};
  5123. Klib.ClueFrame.showLinkPrevSimilar=function(){if(Klib.ClueFrame.isVisible()&&Klib.ClueFrame.isLocked()){Klib.ClueFrame.showNextLink(-1,true)
  5124. }};
  5125. Klib.ClueFrame.showNextLink=function(F,H,D){if(D){Klib.ClueFrame.showLoading();
  5126. Klib.setTimer(function(){Klib.ClueFrame.showNextLink(F,H)
  5127. },D);
  5128. return 
  5129. }else{F=(F===-1)?-1:1;
  5130. var C=null;
  5131. if(Klib.Clue.currentClue&&Klib.Clue.currentClue.link){if(H){C=Klib.ClueFrame.getNextSimilarLink(Klib.Clue.currentClue.link,F)
  5132. }else{var B=Klib.Clue.currentClue.link;
  5133. var G=B.ownerDocument;
  5134. for(var E=0;
  5135. E<G.links.length;
  5136. E++){if(B==G.links[E]){if(F==1&&E<(G.links.length-1)){C=G.links[E+F]
  5137. }else{if(F==-1&&E>0){C=G.links[E+F]
  5138. }}break
  5139. }}}if(C){Klib.LinkScent.setupLink(C);
  5140. C.linkscent.forceLinkscents=true;
  5141. Klib.ClueFrame.showClue(C);
  5142. C.linkscent.forceLinkscents=false
  5143. }else{var A=H?"similar":"";
  5144. Klib.ClueFrame.alert("No more "+A+" links to show","ShowNextLink","warning");
  5145. Klib.ClueFrame.hideLoading()
  5146. }}else{Klib.ClueFrame.alert("Unable to find current clue's link","ShowNextLink:Error","error");
  5147. Klib.warning("showNextLink: Unable to find current clue's link")
  5148. }}};
  5149. Klib.ClueFrame.isLocked=function(){var A=Klib.ClueFrame.getIframe();
  5150. return(A&&A.locked)?true:false
  5151. };
  5152. Klib.ClueFrame.isVisible=function(){var A=Klib.ClueFrame.getIframe();
  5153. return(A&&Klib.ClueFrame.visible)?true:false
  5154. };
  5155. Klib.ClueFrame.handleMouseOutFrame=function(A){var B=Klib.ClueFrame.getIframe();
  5156. if(Klib.ClueFrame.visible&&B&&!B.locked){var C=Klib.LinkScent.findLinkFromEvent(A);
  5157. if(Klib.Clue.currentEle&&(C==Klib.Clue.currentEle)){Klib.ClueFrame.stopHideTimer()
  5158. }else{if(Klib.ClueFrame.mouseNearClueFrame(A)){Klib.ClueFrame.stopHideTimer()
  5159. }else{if(!Klib.Timer.exists("hideClueFrame")){Klib.setNamedTimer("hideClueFrame",Klib.ClueFrame.hide,Klib.Pref.get("ClueFrame.hideDelay",1000))
  5160. }}}}};
  5161. Klib.ClueFrame.stopHideTimer=function(A){Klib.clearTimer("hideClueFrame")
  5162. };
  5163. Klib.ClueFrame.restoreDisabledClue=function(B){var C=B.source.getAttribute("clueid");
  5164. Klib.Pref.set("Clue."+C+".enabled",true);
  5165. var D=Klib.Clue.getClue(C);
  5166. D.enabled=true;
  5167. D.order=Klib.Clue.current.length;
  5168. var A=Klib.getParent(B.source,"li");
  5169. Klib.removeEle(A);
  5170. Klib.Clue.current=Klib.Clue.current.sort(Klib.Clue.sortFunc);
  5171. Klib.Clue.reindex();
  5172. Klib.ClueFrame.showCurrentLink()
  5173. };
  5174. Klib.ClueFrame.donate=function(A){Klib.Window.close("*");
  5175. Klib.ClueBridge.openUrl(Klib.getInterclueUrl("donate",true),true,true)
  5176. };
  5177. Klib.ClueFrame.imagePreviewSizeToFit=function(B){var E=$("imagepreview-image",Klib.ClueFrame.contentFrame.doc);
  5178. var D=$("imagepreview-zoom",Klib.ClueFrame.contentFrame.doc);
  5179. if(E){B.halt();
  5180. var F=$("content",Klib.ClueFrame.contentFrame.doc);
  5181. if(F){Klib.setStyle(F,"overflow","visible")
  5182. }var C=parseInt(E.getAttribute("origwidth"));
  5183. var A=parseInt(E.getAttribute("origheight"));
  5184. Klib.replace(E,"width",C);
  5185. Klib.replace(E,"height",A);
  5186. Klib.restore(E,"title");
  5187. Klib.restore(E,"alt");
  5188. if(D){D.innerHTML="100%"
  5189. }Klib.ClueFrame.resizeToContent(true);
  5190. Klib.Tutorial.fireEvent(Klib.Clue.currentEle,"imagePreviewSizeToFit")
  5191. }else{Klib.error("Unable to find imagepreview image")
  5192. }};
  5193. Klib.ClueFrame.setFocusToClueFrame=function(A){if(!Klib.ClueFrame.currFocus){if(Klib.ClueFrame.contentFrame.win){try{Klib.ClueFrame.contentFrame.win.focus()
  5194. }catch(B){Klib.warning("Error trying to set focus to clueframe")
  5195. }}else{Klib.warning("Clueframe contentframe doesn't exists, unable to set focus()")
  5196. }}};
  5197. Klib.ClueFrame.timerHide=0;
  5198. Klib.ClueFrame.initClueFrameDoc=function(){Klib.Mouse.initDoc(Klib.ClueFrame.doc);
  5199. Klib.Key.initDoc(Klib.ClueFrame.doc);
  5200. Klib.ClueFrame.initContentFrame();
  5201. Klib.ClueFrame.initButtons();
  5202. Klib.ClueFrame.initTitlebar();
  5203. Klib.ClueFrame.initStatusBar();
  5204. Klib.Toggle.initDoc(Klib.ClueFrame.doc);
  5205. if(Klib.Pref.get("ClueFrame.frameType")=="window"){Klib.addEvent(Klib.ClueFrame.win,"beforeunload",Klib.ClueFrame.handleWindowClose);
  5206. Klib.ClueFrame.win.isClueFrameWindow=true;
  5207. Klib.ClueFrame.doc.isClueFrameWindow=true
  5208. }Klib.addEvent(Klib.ClueFrame.doc,"mouseover",Klib.ClueFrame.stopHideTimer);
  5209. Klib.ClueFrame.doc.clueframeReady=true
  5210. };
  5211. Klib.skinUrl=function(){return(Klib.baseUrl+"/skins/"+Klib.Pref.get("ClueFrame.skin","default"))
  5212. };
  5213. Klib.insertStyleSheet=function(A,C){var B=Klib.stylesheets[A].replace(/\{skinUrl\}/g,Klib.skinUrl());
  5214. Klib.addStyle(B,C)
  5215. };
  5216. Klib.ClueFrame.handleMouseWheel=function(A){Klib.Stats.setActive();
  5217. A.halt()
  5218. };
  5219. Klib.ClueFrame.handleMouseWheelIE=function(B){if(B.wheelDelta&&Klib.ClueFrame.contentFrame&&Klib.ClueFrame.contentFrame.doc&&Klib.ClueFrame.contentFrame.doc.body){var C=Klib.getRect(Klib.ClueFrame.contentFrame.doc.body);
  5220. C.setTop(Klib.ClueFrame.contentFrame.doc.body.scrollTop);
  5221. var A=Klib.getRect(Klib.ClueFrame.contentFrame.win);
  5222. if(B.wheelDelta>0&&C.top==0){B.halt()
  5223. }if(B.wheelDelta<0&&(C.top+A.height>=C.height)){B.halt()
  5224. }}};
  5225. Klib.ClueFrame.handle3rdPartyFrameLoad=function(A){var C=(A.contentWindow.document);
  5226. var B=Klib.Clue.currentClue;
  5227. if(B.initFramedContent){B.initFramedContent(C,B)
  5228. }};
  5229. Klib.ClueFrame.initClueFrame=function(){if(Klib.Pref.get("ClueFrame.frameType")=="iframe"){Klib.ClueFrame.doc=Klib.ClueFrame.iframe.doc;
  5230. Klib.ClueFrame.win=Klib.ClueFrame.iframe.win
  5231. }else{if(Klib.Pref.get("ClueFrame.frameType")=="window"){Klib.ClueFrame.doc=Klib.ClueFrame.floatingWin.document;
  5232. Klib.ClueFrame.win=Klib.ClueFrame.floatingWin
  5233. }}Klib.Clue.currentClue=null;
  5234. var B=Klib.ClueFrame.doc;
  5235. if(B.body){try{B.getElementsByTagName("html")[0].className="interclue-clueview"
  5236. }catch(A){Klib.error("Failed to set classname on clueframe")
  5237. }B.title=Klib.string("app.name");
  5238. B.body.innerHTML="";
  5239. Klib.insertStyleSheet("clueFrame.css",B);
  5240. if(Klib.isIE){Klib.insertStyleSheet("clueFrame.ie.css",B)
  5241. }Klib.ClueFrame.win.isClueFrame=true;
  5242. B.body.innerHTML+=Klib.ClueFrame.getHtml();
  5243. Klib.addClass(B.body,"clue"+Klib.Pref.get("ClueFrame.frameType"));
  5244. Klib.addEvent(Klib.ClueFrame.win,"mousewheel",Klib.ClueFrame.handleMouseWheel);
  5245. Klib.addEvent(Klib.ClueFrame.win,"focus",Klib.ClueFrame.handleFocus);
  5246. Klib.addEvent(Klib.ClueFrame.win,"blur",Klib.ClueFrame.handleBlur);
  5247. Klib.doWhen(Klib.ClueFrame.initClueFrameDoc,"Klib.ClueFrame.doc.getElementById('loading')")
  5248. }else{Klib.setNamedTimer("initClueFrame",Klib.ClueFrame.initClueFrame,100)
  5249. }};
  5250. Klib.ClueFrame.exists=function(){switch(Klib.Pref.get("ClueFrame.frameType")){case"window":return Klib.windowExists(Klib.ClueFrame.floatingWin);
  5251. case"iframe":return Klib.ClueFrame.getIframe(true)?true:false;
  5252. default:break
  5253. }return false
  5254. };
  5255. Klib.ClueFrame.setContentFont=function(){var B=Klib.ClueFrame.contentFrame.doc;
  5256. if(B&&B.body){var A='* {font-family : "'+Klib.Pref.get("ClueContent.defaultFont")+'", sans-serif;}';
  5257. Klib.addStyle(A,B)
  5258. }else{Klib.warning("ClueFrame.setContentFont: failed, no doc or doc.body")
  5259. }};
  5260. Klib.ClueFrame.setContentFontSize=function(B,A){B=B||Klib.Pref.get("ClueFrame.contentFontSize",9);
  5261. B=Klib.limit(B,6,16);
  5262. Klib.Pref.set("ClueFrame.contentFontSize",B);
  5263. var C=B+"pt";
  5264. var D=Klib.ClueFrame.contentFrame.doc;
  5265. if(D.body.style.fontSize!=C){D.body.style.fontSize=C
  5266. }if(A){Klib.ClueFrame.status("Font size : "+C)
  5267. }};
  5268. Klib.ClueFrame.getHtml=function(){var A='<div id="container">            <div id="titlebar"> </div>            <div id="titlebar-right" > </div>            <div id="toolbar" > </div>            <div id="content" class="content"> </div>            <div id="interclue-loading-overlay"><div id="interclue-loading-image"></div></div>             <div id="secondary-toolbar"> </div>            <div id="statusbar"> </div>            <div id="resizehandle"> </div>            <div id="loading"> </div>            <img id="dropshadow" src="'+Klib.skinUrl()+'/shadow.png" />        </div>        <div id="logo"> </div>        <div id="alert" >            <div id="alert-box">               <h1 id="alert-title"> </h1>               <div id="alert-message"> </div>               <div id="alert-close" class="toggle" toggleTarget="alert"> </div>               <div id="alert-buttons-block">                    <input id="alert-button-ok" type="button" value="Ok" />                    <input id="alert-button-cancel" type="button" value="Cancel" />                    <label id="alert-dont-show-again-label"><input id="alert-dont-show-again" type="checkbox" /> Do not show this Hint Again</label>                </div>            </div>        </div>';
  5269. return A
  5270. };
  5271. Klib.ClueFrame.toggleLocked=function(B){var A=Klib.ClueFrame.getIframe();
  5272. if(!A){if(Klib.Clue.currentDoc){Klib.ClueBridge.cleanUpDoc(Klib.Clue.currentDoc)
  5273. }Klib.error("Interclue: unable to find ClueViewer");
  5274. return 
  5275. }if(Klib.Pref.get("ClueFrame.allowLocked")){if(B===true){if(A.locked){return 
  5276. }else{A.locked=true
  5277. }}else{if(B===false){if(!A.locked){return 
  5278. }else{A.locked=false
  5279. }}else{A.locked=!A.locked
  5280. }}var C=A.locked?"interclue-locked":"interclue-unlocked";
  5281. Klib.replaceClass(A.doc.body,"interclue-locked, interclue-unlocked",C);
  5282. Klib.Pref.save("ClueFrame.locked",A.locked);
  5283. var E=Klib.getRect(A);
  5284. var D=Klib.ClueFrame.getViewPortRect();
  5285. if(A.locked){if(Klib.ClueFrame.isVisible()&&!Klib.Tutorial.isTutorialUrl(A.ownerDocument.URL)){Klib.ClueFrame.showMessage("ClueFrameLocked")
  5286. }Klib.Tutorial.fireEvent(A.ownerDocument.body,"clueframelock")
  5287. }else{Klib.Tutorial.fireEvent(A.ownerDocument.body,"clueframeunlock")
  5288. }Klib.ClueFrame.refreshButtons()
  5289. }};
  5290. Klib.ClueFrame.showMessage=function(E,B){var A=3;
  5291. B=B||0;
  5292. var C="hint."+E;
  5293. if(Klib.Pref.get(C,true)){if(Klib.ClueFrame.doc&&Klib.ClueFrame.visible){var D=Klib.getString("hint."+E.toLowerCase());
  5294. Klib.ClueFrame.alert(D,"","message",0,function(){var F=$("alert-dont-show-again",Klib.ClueFrame.doc);
  5295. if(F&&F.checked){Klib.Pref.set(C,false)
  5296. }},null,null,true)
  5297. }else{if(B<A){B++;
  5298. Klib.setTimer(function(){Klib.ClueFrame.showMessage(E,B)
  5299. },500)
  5300. }}}};
  5301. Klib.ClueFrame.fixFrameLocation=function(){if(Klib.ClueFrame.getIframe()){Klib.warning("fixFrameLocation(): Lost connection with ClueFrame");
  5302. try{Klib.ClueFrame.kill()
  5303. }catch(A){Klib.error("Can't access clueframe, probably permission denied error.",A)
  5304. }}return false
  5305. };
  5306. Klib.ClueFrame.resizingToContent=false;
  5307. Klib.ClueFrame.restoreSize=function(A){if(Klib.ClueFrame.iframe&&Klib.ClueFrame.iframe.positionBeforeResize){var B=A||Klib.ClueFrame.iframe.positionBeforeResize;
  5308. Klib.setStyle(Klib.ClueFrame.iframe,"top",B.top+"px");
  5309. Klib.setStyle(Klib.ClueFrame.iframe,"left",B.left+"px");
  5310. Klib.setStyle(Klib.ClueFrame.iframe,"width",B.width+"px");
  5311. Klib.setStyle(Klib.ClueFrame.iframe,"height",B.height+"px")
  5312. }};
  5313. Klib.ClueFrame.resizeToContent=function(B,H,I,N){if(Klib.ClueFrame.contentFrame.doc&&Klib.ClueFrame.contentFrame.doc.body){var E=Klib.getRect(Klib.ClueFrame.iframe);
  5314. var G=Klib.getRect(Klib.ClueFrame.contentFrame.doc.body);
  5315. var F=Klib.getRect(Klib.ClueFrame.contentFrame);
  5316. var C=Klib.getRect(Klib.ClueFrame.doc.body);
  5317. var J=Klib.ClueFrame.getViewPortRect();
  5318. var L=(Klib.Pref.get("ClueFrame.frameType")=="window")?Klib.getRect(Klib.ClueFrame.win):Klib.getRect(Klib.ClueFrame.iframe);
  5319. if(Klib.ClueFrame.iframe.style.position=="fixed"){J.setTop(0);
  5320. J.setLeft(0)
  5321. }if(!G.height){return false
  5322. }if(H){G.setWidth(H)
  5323. }if(I){G.setHeight(I)
  5324. }if(N){var M=L.left;
  5325. var K=L.top;
  5326. var D=Klib.limit(G.width,Klib.ClueFrame.CLUEFRAME_MIN_WIDTH,Klib.ClueFrame.CLUEFRAME_MAX_WIDTH);
  5327. var A=Klib.limit(G.height,Klib.ClueFrame.CLUEFRAME_MIN_HEIGHT,Klib.ClueFrame.CLUEFRAME_MAX_HEIGHT)
  5328. }else{var M=L.left;
  5329. var K=L.top;
  5330. var D=G.width+(L.width-F.width);
  5331. var A=G.height+(L.height-F.height);
  5332. if(D>J.width){D=J.width
  5333. }if(A>J.height){A=J.height
  5334. }D=Klib.limit(D,Klib.ClueFrame.CLUEFRAME_MIN_WIDTH,Klib.ClueFrame.CLUEFRAME_MAX_WIDTH);
  5335. A=Klib.limit(A,Klib.ClueFrame.CLUEFRAME_MIN_HEIGHT,Klib.ClueFrame.CLUEFRAME_MAX_HEIGHT);
  5336. if(!B){if(A>(J.height-L.top)){A=J.height-L.top
  5337. }if(D>(J.width-L.left)){D=J.width-L.left
  5338. }}else{if((M+D)>J.right){M=J.right-D;
  5339. M=Klib.limit(M,J.left,J.right)
  5340. }if((K+A)>J.bottom){K=J.bottom-A;
  5341. K=Klib.limit(K,J.top,J.bottom)
  5342. }}if(D<L.width){D=L.width
  5343. }if(A<L.height){A=L.height
  5344. }}Klib.ClueFrame.resizingToContent=true;
  5345. if(Klib.ClueFrame.win&&(Klib.Pref.get("ClueFrame.frameType")=="window")){Klib.ClueFrame.win.moveTo(M,K);
  5346. Klib.ClueFrame.win.resizeTo(D,A);
  5347. Klib.setNamedTimer("finishedResizing",function(){Klib.ClueFrame.resizingToContent=false
  5348. },500)
  5349. }else{if(Klib.ClueFrame.iframe&&(Klib.Pref.get("ClueFrame.frameType")=="iframe")){Klib.ClueFrame.iframe.positionBeforeResize=Klib.ClueFrame.iframe.positionBeforeResize||{left:Klib.ClueFrame.iframe.style.left,top:Klib.ClueFrame.iframe.style.top,width:Klib.ClueFrame.iframe.style.width,height:Klib.ClueFrame.iframe.style.height};
  5350. Klib.setStyle(Klib.ClueFrame.iframe,"top",K+"px");
  5351. Klib.setStyle(Klib.ClueFrame.iframe,"left",M+"px");
  5352. Klib.setStyle(Klib.ClueFrame.iframe,"width",D+"px");
  5353. Klib.setStyle(Klib.ClueFrame.iframe,"height",A+"px");
  5354. Klib.ClueFrame.resizingToContent=false
  5355. }}return E
  5356. }else{Klib.warning("resizeToContent: Unable to resize, doc not ready?",Klib.ClueFrame.contentFrame.doc);
  5357. return false
  5358. }};
  5359. Klib.ClueFrame.createFakeLink=function(A,E,F,D){var B=F?$(F,D):null;
  5360. if(!B){B=D.createElement("a");
  5361. B.setAttribute("href",A);
  5362. B.setAttribute("id",F);
  5363. B.style.display="none";
  5364. var C=D.createTextNode(E||A);
  5365. B.appendChild(C);
  5366. D.body.appendChild(B);
  5367. Klib.LinkScent.initLink(B,true)
  5368. }return B
  5369. };
  5370. Klib.ClueFrame.showCurrentPage=function(){var B=Klib.ClueBridge.sourceDoc;
  5371. if(Klib.Clue.docAllowsClues(B)){var A=Klib.ClueFrame.createFakeLink(B.URL,B.title,"interclue-current-document-link",B);
  5372. Klib.Clue.currentEle=null;
  5373. Klib.Clue.hoverLink=A;
  5374. Klib.Clue.setEventPosition(Klib.Mouse);
  5375. Klib.Clue.showClues("showCurrentPage")
  5376. }else{alert(Klib.string("clueframe.error.document.doesnt.allow.clues"))
  5377. }};
  5378. Klib.ClueFrame.showUrl=function(A,E){E=E||A;
  5379. var D=Klib.ClueBridge.sourceDoc;
  5380. if(Klib.Clue.docAllowsClues(D)){var C=Klib.ClueFrame.createFakeLink(A,E,"",D);
  5381. Klib.Clue.currentEle=null;
  5382. Klib.Clue.hoverLink=C;
  5383. var B=Klib.ClueFrame.getIframe();
  5384. if(B){B.dontReposition=true;
  5385. Klib.Clue.showClues("showUrl "+A);
  5386. B.dontReposition=false
  5387. }else{Klib.Clue.setEventPosition(Klib.Mouse);
  5388. Klib.Clue.showClues("showUrl "+A)
  5389. }}else{alert(Klib.string("clueframe.error.document.doesnt.allow.clues"))
  5390. }};
  5391. Klib.ClueFrame.showCurrentClueHelp=function(){var B=Klib.Clue.currentClue;
  5392. if(B&&B.help){var A=Klib.substitute(B.help,B.subs);
  5393. Klib.ClueFrame.alert(A,B.name,"",false)
  5394. }else{Klib.ClueFrame.alert(Klib.string("clueframe.error.no.help.for.clue"),B.name)
  5395. }};
  5396. Klib.ClueFrame.timerCheckFrameLocation=function(){if(Klib.Global.get("loggedIn")){if(Klib.windowExists(Klib.ClueFrame.win)&&!Klib.ClueFrame.building){try{if(!Klib.ClueFrame.win.isClueFrame){Klib.setNamedTimer("ClueFrame.fixFrameLocation",Klib.ClueFrame.fixFrameLocation,200)
  5397. }}catch(A){Klib.setNamedTimer("ClueFrame.fixFrameLocation",Klib.ClueFrame.fixFrameLocation,200)
  5398. }}Klib.setNamedTimer("CheckFrameLocation",Klib.ClueFrame.timerCheckFrameLocation,200)
  5399. }};
  5400. Klib.ClueFrame.reconnectToClueframe=function(C){Klib.ClueFrame.iframe=null;
  5401. Klib.ClueFrame.contentFrame=null;
  5402. try{var A=C.getElementById("ClueFrame");
  5403. if(A&&A.contentFrame){Klib.ClueFrame.contentFrame=A.contentFrame;
  5404. Klib.ClueFrame.iframe=A;
  5405. Klib.ClueFrame.doc=A.doc;
  5406. Klib.ClueFrame.win=A.win;
  5407. if(A.locked){Klib.ClueFrame.initButtons()
  5408. }else{Klib.ClueFrame.hide(true)
  5409. }}}catch(B){Klib.error("Error when reconnecting to Clueviewer",B)
  5410. }};
  5411. Klib.GEvent.addEvent("login",Klib.ClueFrame.timerCheckFrameLocation);
  5412. Klib.GEvent.addEvent("logout",Klib.ClueFrame.kill);
  5413. Klib.GEvent.addEvent("newdocument",Klib.ClueFrame.reconnectToClueframe)
  5414. }Klib.ClueFrame.buttons.push({id:"prevSimilarLink",groupId:"linkNavigationSimilar",groupDescription:"{clueframe.buttongroup.linkNavigationSimilar}",tooltip:"{clueframe.button.prevSimilarLink}",onclick:function(){Klib.ClueFrame.showNextLink(-1,true,250)
  5415. },location:"",sprite:"prevSimilarLink",spriteDisabled:"prevSimilarLinkDisabled",enabled:function(){return true
  5416. }});
  5417. Klib.ClueFrame.buttons.push({id:"nextSimilarLink",groupId:"linkNavigationSimilar",tooltip:"{clueframe.button.nextSimilarLink}",onclick:function(){Klib.ClueFrame.showNextLink(+1,true,250)
  5418. },location:"",sprite:"nextSimilarLink",spriteDisabled:"nextSimilarLinkDisabled",enabled:function(){return true
  5419. }});
  5420. Klib.ClueFrame.buttons.push({id:"bookmark",tooltip:"{clueframe.button.bookmark}",onclick:function(A){var B=Klib.ClueFrame.getCurrentURL();
  5421. var C=Klib.ClueFrame.getCurrentLink();
  5422. if(B&&C){var D="Clue : "+Klib.innerText(C)+" : "+B;
  5423. Klib.ClueBridge.addBookmark(B,D)
  5424. }else{alert("Unable to find current link")
  5425. }},sprite:"bookmark",spriteDisabled:"bookmarkDisabled",enabled:function(A){return(Klib.platform!="SiteClues")&&A&&A.link
  5426. }});
  5427. Klib.ClueFrame.buttons.push({id:"followCurrentLinkNewTabFocus",tooltip:"{clueframe.button.followcurrentlinknewtabfocus}",onclick:function(A){var B=Klib.ClueFrame.getCurrentURL();
  5428. if(B){Klib.clearTimer("followCurrentLinkNewTab");
  5429. Klib.ClueBridge.openUrl(B,true,true,true)
  5430. }else{alert("Unable to find URL of current clue")
  5431. }},sprite:"followCurrentLinkNewTabFocus",spriteDisabled:"followCurrentLinkNewTabFocusDisabled",getVisibility:function(A){if(A&&A.link&&A.link.href){if(Klib.ClueBridge.getBrowserByUrl(Klib.getFixedHref(A.link))){return"hidden"
  5432. }else{return"visible"
  5433. }}else{return"disabled"
  5434. }}});
  5435. Klib.ClueFrame.buttons.push({id:"followCurrentLinkNewTab",tooltip:"{clueframe.button.followcurrentlinknewtab}",onclick:function(B){var A=Klib.ClueFrame.getCurrentURL();
  5436. if(A){Klib.setNamedTimer("followCurrentLinkNewTab",function(){Klib.ClueBridge.openUrl(A,true);
  5437. Klib.setTimer(Klib.ClueFrame.refreshButtons,500)
  5438. },500)
  5439. }else{alert("Unable to find URL of current clue")
  5440. }},dblclick:function(A){var B=Klib.ClueFrame.getCurrentURL();
  5441. if(B){Klib.clearTimer("followCurrentLinkNewTab");
  5442. Klib.ClueBridge.openUrl(B,true,true,true)
  5443. }},sprite:"followCurrentLinkNewTab",spriteDisabled:"followCurrentLinkNewTabDisabled",getVisibility:function(A){if(A&&A.link&&A.link.href){if(Klib.ClueBridge.getBrowserByUrl(Klib.getFixedHref(A.link))){return"hidden"
  5444. }else{return"visible"
  5445. }}else{return"disabled"
  5446. }}});
  5447. Klib.ClueFrame.buttons.push({id:"followCurrentLink",tooltip:"{clueframe.button.followcurrentlink}",onclick:function(A){var B=Klib.ClueFrame.getCurrentURL();
  5448. if(B){Klib.ClueBridge.openUrl(B)
  5449. }else{alert("Unable to find URL of current clue")
  5450. }},sprite:"followCurrentLink",spriteDisabled:"followCurrentLinkDisabled",getVisibility:function(A){if(A&&A.link&&A.link.href){if(Klib.ClueBridge.getBrowserByUrl(Klib.getFixedHref(A.link))){return"hidden"
  5451. }else{return"visible"
  5452. }}else{return"disabled"
  5453. }}});
  5454. Klib.ClueFrame.buttons.push({id:"selectTabForLink",tooltip:"{clueframe.button.selectTabForLink}",onclick:function(A){var B=Klib.ClueFrame.getCurrentURL();
  5455. if(B){Klib.ClueBridge.openUrl(B,true,true,true)
  5456. }else{alert("Unable to find URL of current clue")
  5457. }},sprite:"selectTabForLink",getVisibility:function(A){if(A&&A.link&&A.link.href&&Klib.ClueBridge.getBrowserByUrl(Klib.getFixedHref(A.link))){return"visible"
  5458. }else{return"hidden"
  5459. }}});
  5460. Klib.ClueFrame.buttons.push({id:"sendTo",tooltip:"{clueframe.button.sendto}",onclick:function(A){var B=Klib.Clue.currentClue;
  5461. Klib.Clue.sendEmail(B)
  5462. },sprite:"email",enabled:function(){return true
  5463. }});
  5464. Klib.ClueFrame.buttons.push({id:"copyToClipboard",tooltip:"{clueframe.button.copytoclipboard}",onclick:function(A){Klib.Clue.copyToClipboard(Klib.Clue.currentClue)
  5465. },sprite:"copyToClipboard",enabled:function(){return(Klib.platform=="firefox"||Klib.platform=="IEToolbar")
  5466. }});
  5467. Klib.ClueFrame.buttons.push({id:"copyLinkUrlToClipboard",tooltip:"{clueframe.button.copylinkurltoclipboard}",onclick:function(A){Klib.Clue.copyLinkUrlToClipboard(Klib.Clue.currentClue)
  5468. },sprite:"copyLinkUrlToClipboard",enabled:function(){return(Klib.platform=="firefox"||Klib.platform=="IEToolbar")
  5469. }});
  5470. Klib.ClueFrame.buttons.push({id:"print",tooltip:"{clueframe.button.print}",onclick:function(){Klib.ClueFrame.contentFrame.win.print()
  5471. },sprite:"print",enabled:function(){return true
  5472. }});
  5473. Klib.ClueFrame.buttons.push({id:"refresh",tooltip:"{clueframe.button.refresh}",onclick:function(A){Klib.ClueFrame.forceRefresh()
  5474. },sprite:"refresh"});
  5475. Klib.ClueFrame.buttons.push({id:"fontsizeIncrease",tooltip:"{clueframe.button.fontsizeincrease}",onclick:function(A){Klib.ClueFrame.setContentFontSize(Klib.Pref.get("ClueFrame.contentFontSize",9)+1,true)
  5476. },sprite:"fontsizeIncrease"});
  5477. Klib.ClueFrame.buttons.push({id:"fontsizeDecrease",tooltip:"{clueframe.button.fontsizedecrease}",onclick:function(A){Klib.ClueFrame.setContentFontSize(Klib.Pref.get("ClueFrame.contentFontSize",9)-1,true)
  5478. },sprite:"fontsizeDecrease"});
  5479. Klib.ClueFrame.buttons.push({id:"options",tooltip:"{clueframe.button.options}",onclick:function(){Klib.Pref.openPrefsWindow("clueframebuttons")
  5480. },enabled:function(){return(Klib.platform!="SiteClues")
  5481. },sprite:"preferences"});
  5482. Klib.ClueFrame.buttons.push({id:"bugReport",tooltip:"{clueframe.button.bugreport}",onclick:Klib.BugReporter.openWin,sprite:"feedback"});
  5483. Klib.ClueFrame.buttons.push({id:"reddit",tooltip:"{clueframe.button.reddit}",onclick:function(){var A=2000;
  5484. var B=Klib.encode("http://reddit.com/submit?url={url}&title={url}",Klib.ClueFrame.getCurrentURL(),Klib.Clue.currentClue.getTitle());
  5485. B=B.substr(0,A);
  5486. Klib.ClueBridge.sourceWin.open(B,"InterclueReddit","width=640,height=480,resizable=yes,scrollbars=yes,toolbar=no")
  5487. },sprite:"reddit",enabled:function(){return(Klib.platform!="winclues")
  5488. }});
  5489. Klib.ClueFrame.buttons.push({id:"facebookBookmark",tooltip:"{clueframe.button.facebook}",onclick:function(){var A=2000;
  5490. var B=Klib.encode("http://www.facebook.com/sharer.php?u={url}&t={url}",Klib.ClueFrame.getCurrentURL(),Klib.Clue.currentClue.getTitle());
  5491. B=B.substr(0,A);
  5492. Klib.ClueBridge.sourceWin.open(B,"InterclueFacebook","width=626,height=436,resizable=yes,scrollbars=yes,toolbar=no")
  5493. },sprite:"facebook",enabled:function(){return(Klib.platform!="winclues")
  5494. }});
  5495. Klib.ClueFrame.buttons.push({id:"delicious",tooltip:"{clueframe.button.delicious}",onclick:function(){Klib.Delicious.bookmarkLink()
  5496. },sprite:"delicious",enabled:function(){return(Klib.platform!="winclues")
  5497. }});
  5498. Klib.ClueFrame.buttons.push({id:"stumbleUpon",tooltip:"{clueframe.button.stumbleUpon}",onclick:function(){var A=2000;
  5499. var C=Klib.ClueFrame.getCurrentURL();
  5500. var B="http://www.stumbleupon.com/url/"+C;
  5501. B=B.substr(0,A);
  5502. Klib.ClueBridge.sourceWin.open(B,"InterclueStumbleupon","width=640,height=480,resizable=yes,scrollbars=yes,toolbar=no")
  5503. },sprite:"stumbleUpon",enabled:function(){return(Klib.platform!="winclues")
  5504. }});
  5505. Klib.ClueFrame.buttons.push({id:"windowsLive",tooltip:"{clueframe.button.windowsLive}",onclick:function(){var A=2000;
  5506. var B=Klib.encode("https://favorites.live.com/quickadd.aspx?marklet=1&url={url}&title={url}&top=0",Klib.ClueFrame.getCurrentURL(),Klib.Clue.currentClue.getTitle());
  5507. B=B.substr(0,A);
  5508. Klib.ClueBridge.sourceWin.open(B,"InterclueWindowsLive","width=640,height=480,resizable=yes,scrollbars=yes,toolbar=no")
  5509. },sprite:"windows",enabled:function(){return(Klib.platform!="winclues")
  5510. }});
  5511. Klib.ClueFrame.buttons.push({id:"digg",tooltip:"{clueframe.button.digg}",onclick:function(){var A=2000;
  5512. var E=Klib.ClueFrame.contentFrame.doc;
  5513. var C=E?Klib.getSelectedHtml(E):"";
  5514. var D=Klib.ClueFrame.getCurrentURL();
  5515. var F=Klib.Clue.currentClue.getTitle();
  5516. var B="http://digg.com/submit?phase=2&url="+encodeURIComponent(D)+"&title="+encodeURIComponent(F)+"&bodytext="+encodeURIComponent(C);
  5517. B=B.substr(0,A);
  5518. Klib.ClueBridge.sourceWin.open(B,"InterclueDigg","width=640,height=480,resizable=yes,scrollbars=yes,toolbar=no")
  5519. },sprite:"digg",enabled:function(){return(Klib.platform!="winclues")
  5520. }});
  5521. Klib.ClueFrame.buttons.push({id:"yahooMyWeb",tooltip:"{clueframe.button.yahooMyWeb}",onclick:function(){var A=2000;
  5522. var E=Klib.ClueFrame.contentFrame.doc;
  5523. var C=E?Klib.getSelectedHtml(E):"";
  5524. var D=Klib.ClueFrame.getCurrentURL();
  5525. var F=Klib.Clue.currentClue.getTitle();
  5526. var B="http://myweb.yahoo.com/myresults/bookmarklet?t="+encodeURIComponent(F)+"&u="+encodeURIComponent(D)+"&ei=UTF-8&d="+C;
  5527. B=B.substr(0,A);
  5528. Klib.ClueBridge.sourceWin.open(B,"InterclueYahoo","width=640,height=480,resizable=yes,scrollbars=yes,toolbar=no")
  5529. },sprite:"yahoo",enabled:function(){return(Klib.platform!="winclues")
  5530. }});
  5531. Klib.ClueFrame.buttons.push({id:"googleBookmark",tooltip:"{clueframe.button.google.bookmark}",onclick:function(){var A=2000;
  5532. var E=Klib.ClueFrame.contentFrame.doc;
  5533. var C=E?Klib.getSelectedHtml(E):"";
  5534. var D=Klib.ClueFrame.getCurrentURL();
  5535. var F=Klib.Clue.currentClue.getTitle();
  5536. var B="http://www.google.com/bookmarks/mark?op=edit&bkmk="+encodeURIComponent(D)+"&title="+encodeURIComponent(F)+"&annotation="+encodeURIComponent(C);
  5537. B=B.substr(0,A);
  5538. Klib.ClueBridge.sourceWin.open(B,"InterclueGoogleBookmark","width=640,height=480,resizable=yes,scrollbars=yes,toolbar=no")
  5539. },sprite:"google",enabled:function(){return(Klib.platform!="winclues")
  5540. }});
  5541. Klib.ClueFrame.buttons.push({id:"newsvineSeed",tooltip:"{clueframe.button.newsvine.seed}",onclick:function(){var A=2000;
  5542. var D=Klib.ClueFrame.contentFrame.doc;
  5543. var F=D?Klib.getSelectedText(D):"";
  5544. var C=Klib.ClueFrame.getCurrentURL();
  5545. var E=Klib.Clue.currentClue.getTitle();
  5546. var B="http://www.newsvine.com/_wine/save?ver=2&popoff=1";
  5547. B=Klib.Url.add(B,"u",C);
  5548. B=Klib.Url.add(B,"h",E);
  5549. B=Klib.Url.add(B,"s",F);
  5550. B=B.substr(0,A);
  5551. Klib.ClueBridge.sourceWin.open(B,"InterclueNewsvine","width=590,height=600,resizable=yes,scrollbars=yes,toolbar=no")
  5552. },sprite:"newsvine",enabled:function(){return(Klib.platform!="winclues")
  5553. }});
  5554. Klib.ClueFrame.buttons.push({id:"turboNote",tooltip:"{clueframe.button.turboNote}",url:"http://turbonote.com/TBNPlusIntro::.@DIO",urlText:"http://turbonote.com/",onclick:function(){var E="";
  5555. if(top.interclue.isWindows()){var F=top.interclue.getRegistryValue("HKLM\\SOFTWARE\\SPIS Ltd\\TurboNote\\Location");
  5556. if(F){var B=F+"\\tbnote.exe";
  5557. if(top.interclue.fileExists(B)){var G=Klib.Clue.getClueText(Klib.Clue.currentClue);
  5558. var D=Klib.textToRTF(G);
  5559. var A=top.interclue.writeTempFile(D);
  5560. var C=["/new",A];
  5561. top.interclue.exec(B,C);
  5562. Klib.ClueFrame.alert(_("clueframe.button.turboNote.newNoteCreated"),"TurboNote")
  5563. }else{E="Unable to find TurboNote executable\n["+F+"]"
  5564. }}else{E="Unable to extact TurboNote location from registry.\nTurboNote does not appear to be correctly installed."
  5565. }}else{E="Sorry, TurboNote is only availble for Windoze PCs"
  5566. }if(E){if(confirm(E+"\n\nShould we remove the TurboNote button?")){Klib.Pref.set("Button.turboNote.showInTitlebar",false);
  5567. Klib.ClueFrame.refreshButtons()
  5568. }}},sprite:"turboNote",enabled:function(){return true
  5569. },init:function(){if(top.interclue.isWindows()){var A=top.interclue.getRegistryValue("HKLM\\SOFTWARE\\SPIS Ltd\\TurboNote\\Location");
  5570. if(A&&top.interclue.fileExists(A+"\\tbnote.exe")){return true
  5571. }}Klib.Pref.set("Button.turboNote.showInTitlebar",false);
  5572. return false
  5573. }});
  5574. Klib.ClueFrame.buttons.push({id:"summaryImagesEnable",groupId:"summaryImagesEnable",groupDescription:"{clueframe.buttongroup.summaryImages}",tooltip:"{clueframe.button.summaryimagesenable}",onclick:function(){Klib.Pref.set("Summary.images",true);
  5575. Klib.ClueFrame.refreshButtons();
  5576. Klib.Clue.currentClue.reload()
  5577. },sprite:"summaryImagesEnable",enabled:function(){return !Klib.Pref.get("Summary.images")
  5578. }});
  5579. Klib.ClueFrame.buttons.push({id:"summaryImagesDisable",groupId:"summaryImagesEnable",tooltip:"{clueframe.button.summaryimagesdisable}",onclick:function(){Klib.Pref.set("Summary.images",false);
  5580. Klib.ClueFrame.refreshButtons();
  5581. Klib.Clue.currentClue.reload()
  5582. },sprite:"summaryImagesDisable",enabled:function(){return Klib.Pref.get("Summary.images")
  5583. }});
  5584. Klib.ClueFrame.buttons.push({id:"donate",tooltip:"{clueframe.button.donate}",onclick:Klib.ClueFrame.donate,sprite:"donate",enabled:function(){return(Klib.platform!="winclues")
  5585. }});
  5586. Klib.ClueFrame.buttons.push({id:"history",groupId:"history",groupDescription:"{clueframe.buttongroup.history}",tooltip:"{clueframe.button.history}",onclick:Klib.ClueFrame.historyPrev,location:"titlebar-right",sprite:"historyPrev",spriteDisabled:"historyPrevDisabled",enabled:function(){var A=Klib.ClueFrame.getHistory();
  5587. return(A&&A.canShowPrev())
  5588. }});
  5589. Klib.ClueFrame.buttons.push({id:"historyNext",groupId:"history",tooltip:"{clueframe.button.historyNext}",onclick:Klib.ClueFrame.historyNext,location:"titlebar-right",sprite:"historyNext",spriteDisabled:"historyNextDisabled",enabled:function(){var A=Klib.ClueFrame.getHistory();
  5590. return(A&&A.canShowNext())
  5591. }});
  5592. Klib.ClueFrame.buttons.push({id:"prevLink",groupId:"linkNavigation",groupDescription:"{clueframe.buttongroup.linkNavigation}",tooltip:"{clueframe.button.prevLink}",onclick:function(){Klib.ClueFrame.showNextLink(-1,false,250)
  5593. },location:"titlebar-right",sprite:"prevLink",spriteDisabled:"prevLinkDisabled",enabled:function(){return true
  5594. }});
  5595. Klib.ClueFrame.buttons.push({id:"nextLink",groupId:"linkNavigation",tooltip:"{clueframe.button.nextLink}",onclick:function(){Klib.ClueFrame.showNextLink(+1,false,250)
  5596. },location:"titlebar-right",sprite:"nextLink",spriteDisabled:"nextLinkDisabled",enabled:function(){return true
  5597. }});
  5598. Klib.ClueFrame.buttons.push({id:"lock",groupId:"lock",groupDescription:"Lock the {clueframe} in place",tooltip:"Lock the {clueframe} in place",onclick:Klib.ClueFrame.toggleLocked,location:"titlebar-right",sprite:"clueframeLock",locked:true,enabled:function(){var A=Klib.ClueFrame.getIframe();
  5599. return !(A&&A.locked)
  5600. }});
  5601. Klib.ClueFrame.buttons.push({id:"unlock",groupId:"lock",tooltip:"Close the {clueframe}.",onclick:function(){Klib.ClueFrame.hide(true)
  5602. },location:"titlebar-right",sprite:"close",locked:true,enabled:function(){var A=Klib.ClueFrame.getIframe();
  5603. return(A&&A.locked)
  5604. }});
  5605. Klib.CustomButton=function(B){var A=this;
  5606. A.id=B;
  5607. A.unsafe=null;
  5608. A.tooltip=A.id;
  5609. A.imageURL=Klib.skinUrl()+"/custombutton.png";
  5610. A.imageDisabledURL=Klib.skinUrl()+"/custombuttonDisabled.png",A.loadButtonCode=function(){var C="interclue.custombutton."+A.id;
  5611. return top.interclue.getPref(C,"")
  5612. };
  5613. A.saveButtonCode=function(C){var D="interclue.custombutton."+A.id;
  5614. return top.interclue.setPref(D,C)
  5615. };
  5616. A.isSafeURL=function(C){return/^http(s)?:\/\/.*$/.test(C)
  5617. };
  5618. A.load=function(){A.win=Klib.CustomButtons.getWin();
  5619. var D=A.loadButtonCode();
  5620. var C=Klib.CustomButtons.generateButton(D);
  5621. if(C){A.unsafe=C;
  5622. if(typeof A.unsafe.tooltip=="string"&&A.unsafe.tooltip!=""){A.tooltip=A.unsafe.tooltip
  5623. }if(typeof A.unsafe.imageURL=="string"&&A.isSafeURL(A.unsafe.imageURL)){A.imageURL=A.unsafe.imageURL
  5624. }if(typeof A.unsafe.imageDisabledURL=="string"&&A.isSafeURL(A.unsafe.imageDisabledURL)){A.imageDisabledURL=A.unsafe.imageDisabledURL
  5625. }if(typeof A.unsafe.onclick!="function"){A.unsafe.onclick=function(){}
  5626. }if(typeof A.unsafe.ondblclick!="function"){A.unsafe.ondblclick=function(){}
  5627. }return true
  5628. }else{throw Error("Failed to create custom button #"+A.id+"\nJavascript error")
  5629. }};
  5630. A.save=function(){};
  5631. A.isDisabled=function(){if(A.unsafe.isDisabled){return A.callFunction("isDisabled")
  5632. }return false
  5633. };
  5634. A.callFunction=function(F){A.setInfo();
  5635. A.win.result=null;
  5636. var D="var result = null; result = Buttons['"+A.id+"']."+F+"()";
  5637. var E=Klib.getDoc(A.win);
  5638. var C=E.createElement("script");
  5639. C.type="text/javascript";
  5640. C.appendChild(E.createTextNode(D));
  5641. E.body.appendChild(C);
  5642. if(A.win.result===true){return true
  5643. }else{if(A.win.result===false){return false
  5644. }else{return null
  5645. }}};
  5646. A.onclick=function(){if(A.unsafe.onclick){A.callFunction("onclick");
  5647. return true
  5648. }return false
  5649. };
  5650. A.ondblclick=function(){if(A.unsafe.ondblclick){A.callFunction("ondblclick");
  5651. return true
  5652. }return false
  5653. };
  5654. A.enable=function(){A.disabled=false;
  5655. Klib.setBackground(A.img,A.imageURL);
  5656. Klib.setStyle(A.button,"display","")
  5657. };
  5658. A.disable=function(){A.disabled=true;
  5659. Klib.setBackground(A.img,A.imageDisabledURL);
  5660. Klib.setStyle(A.button,"display","")
  5661. };
  5662. A.hide=function(){Klib.setStyle(A.button,"display","none")
  5663. };
  5664. A.build=function(C){var D=C.ownerDocument;
  5665. A.button=D.createElement("a");
  5666. A.button.setAttribute("id","custombutton-"+A.id);
  5667. A.button.setAttribute("href","javascript:;");
  5668. A.button.setAttribute("title",A.tooltip);
  5669. A.button.className="toolbarbutton toolbarbutton-normal";
  5670. Klib.setStyle(A.button,"display","");
  5671. A.img=D.createElement("img");
  5672. A.img.src=Klib.Image.pixel();
  5673. A.img.width=16;
  5674. A.img.height=16;
  5675. A.button.appendChild(A.img);
  5676. C.appendChild(A.button);
  5677. Klib.setBackground(A.img,A.imageURL);
  5678. Klib.addEvent(A.button,"mousedown",A.handleMouseDown);
  5679. Klib.addEvent(A.button,"click",A.handleClick);
  5680. Klib.addEvent(A.button,"dblclick",A.handleDblClick);
  5681. return A
  5682. };
  5683. A.setInfo=function(){A.win.Clue={linkURL:"",linkTitle:"",linkText:"",linkHTML:"",documentURL:"",documentTitle:"",selectedHTML:"",selectedText:""};
  5684. A.win.Clue.resizeTo=function(F,E){Klib.ClueFrame.resizeToContent(true,F,E)
  5685. };
  5686. A.win.Clue.navigateTo=function(E,G,F,N){if(F||N){Klib.ClueFrame.resizeToContent(true,F,N)
  5687. }Klib.ClueFrame.setContent('<iframe id="interclue-clueview-button-frame" src="about:blank" frameborder="0" style="border: 0px; width: 100%; height: 100%"></iframe>');
  5688. var I=Klib.ClueFrame.contentFrame.doc.getElementById("interclue-clueview-button-frame");
  5689. if(!/^http(s)?:\/\//i.test(E)){throw Error("Interclue: invalid URL in custom button script, Clue.openIframe(url). Only 'http' or 'https' URLs are allowed")
  5690. }else{if(!I){throw Error("Interclue: unable to find iframe #interclue-clueview-button-frame")
  5691. }else{if(G){var L=I.contentWindow.document;
  5692. var K=L.createElement("form");
  5693. K.setAttribute("action",E);
  5694. K.setAttribute("method","POST");
  5695. K.setAttribute("enctype","multipart/form-data");
  5696. L.body.appendChild(K);
  5697. for(var M in G){var H=G[M];
  5698. if(typeof H==="string"||typeof H==="number"){var O=L.createElement("textarea");
  5699. O.setAttribute("name",M);
  5700. O.value=H;
  5701. K.appendChild(O)
  5702. }else{if(H.length){for(var J=0;
  5703. J<H.length;
  5704. J++){var O=L.createElement("textarea");
  5705. O.setAttribute("name",M);
  5706. O.value=H[J];
  5707. K.appendChild(O)
  5708. }}}}K.submit()
  5709. }else{I.setAttribute("src",E)
  5710. }}}A.iframe=I;
  5711. Klib.setInterval("CustomButtonIframeMessageWatcher",A.checkForIframeMessages,200)
  5712. };
  5713. if(Klib.Clue.currentClue){var C=Klib.Clue.currentClue.link;
  5714. A.win.Clue.linkURL=Klib.getFixedHref(C);
  5715. A.win.Clue.linkTitle=Klib.Clue.currentClue.getTitle();
  5716. A.win.Clue.linkText=Klib.innerText(C);
  5717. A.win.Clue.linkHTML=C.innerHTML;
  5718. A.win.Clue.documentURL=C.ownerDocument.URL;
  5719. A.win.Clue.documentTitle=C.ownerDocument.title
  5720. }var D=Klib.ClueFrame.contentFrame.doc;
  5721. A.win.Clue.selectedHTML=D?Klib.getSelectedHtml(D):"";
  5722. A.win.Clue.selectedText=Klib.Html.toText(A.win.Clue.selectedHTML)
  5723. };
  5724. A.handleMessage=function(C){switch(C){case"close()":Klib.ClueFrame.hide(true);
  5725. A.stopCheckingForIframeMessages();
  5726. break;
  5727. default:if(A.lastMessage!=C){A.lastMessage=C;
  5728. throw Error("Unknown Custom Button iframe message '"+C+"'")
  5729. }}};
  5730. A.stopCheckingForIframeMessages=function(){Klib.clearTimer("CustomButtonIframeMessageWatcher")
  5731. };
  5732. A.checkForIframeMessages=function(){if(!A.iframe){A.stopCheckingForIframeMessages()
  5733. }else{if(A.iframe.contentWindow&&A.iframe.contentWindow.location&&A.iframe.contentWindow.location.hash){var D=A.iframe.contentWindow.location.hash.substr(1);
  5734. var C=D.match(/^interclue:(.*)$/);
  5735. if(C&&C[1]){A.handleMessage(Klib.trim(C[1]))
  5736. }}else{}}};
  5737. A.handleMouseDown=function(C){if(C.button==2){C.halt();
  5738. Klib.CustomButtons.openEditor(A.id)
  5739. }};
  5740. A.handleClick=function(C){if(!A.disabled){var D=A.setInfo();
  5741. A.onclick(D)
  5742. }};
  5743. A.handleDblClick=function(C){if(!A.disabled){var D=A.setInfo();
  5744. A.ondblclick(D)
  5745. }}
  5746. };
  5747. Klib.CustomButtons={};
  5748. Klib.CustomButtons.items={};
  5749. Klib.CustomButtons.init=function(){Klib.CustomButtons.items=Klib.Pref.get("CustomButtons.enabled")?Klib.CustomButtons.loadAll():{}
  5750. };
  5751. Klib.CustomButtons.loadAll=function(){var A=Klib.CustomButtons.getButtonIds();
  5752. var D={};
  5753. for(var C=0;
  5754. C<A.length;
  5755. C++){var E=A[C];
  5756. var B=new Klib.CustomButton(E);
  5757. if(B.load()){B.enabled=Klib.Pref.get("CustomButton."+E+".enabled");
  5758. D[E]=B
  5759. }}return D
  5760. };
  5761. Klib.CustomButtons.isValidCustomButtonDoc=function(C){var B=false;
  5762. if(C&&C.URL){var A=Klib.Url.parse(C.URL);
  5763. if(A&&/\.interclue\.js$/.test(A.filename)){B=true
  5764. }}return B
  5765. };
  5766. Klib.CustomButtons.getButtonIds=function(){var B=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
  5767. var C=B.getChildList("interclue.custombutton",{});
  5768. for(var A=0;
  5769. A<C.length;
  5770. A++){C[A]=C[A].replace("interclue.custombutton.","")
  5771. }return C
  5772. };
  5773. Klib.CustomButtons.openEditor=function(A){A=A||"";
  5774. window.open("chrome://interclue/content/cluecore/buttons/editor.xul?url="+A,"InterclueCustomButtonEditor","chrome=yes,dependent=yes")
  5775. };
  5776. Klib.CustomButtons.renderButtonsTable=function(){var I='<table class="datatable" cellpadding="0" cellspacing="0" width="100%">        <col width="32" /><col width="100%" /><col width="60" /><col width="60" />        <tr class="thead"><th> </th><th align="left">'+Klib.string("custombuttons.buttontable.buttonname")+"</th><th>"+Klib.string("custombuttons.buttontable.actions")+"</th><th>"+Klib.string("custombuttons.buttontable.enabled")+"</th></tr>";
  5777. var D=Klib.CustomButtons.getButtonIds();
  5778. var E=Klib.CustomButtons.loadAll();
  5779. var J=true;
  5780. for(var G=0;
  5781. G<D.length;
  5782. G++){var C=D[G];
  5783. var B=E[C];
  5784. var A=Klib.htmlspecialchars(C);
  5785. var H=J?"odd":"even";
  5786. J=!J;
  5787. I+='<tr class="'+H+'">';
  5788. if(B){var F='<img class="custombutton-image" src="'+Klib.htmlspecialchars(B.imageURL)+'" width="16" height="16" />';
  5789. I+="<td>"+F+'</td><td style="text-align: left">'+A+"</td>";
  5790. I+='<td><a class="custombutton-edit-link" href="javascript:;" custombuttonid="'+A+'" title="'+Klib.string("custombuttons.buttontable.edit")+'">'+Klib.sprites.buttonEditor.getHTML()+"</a>";
  5791. I+=' <a class="custombutton-delete-link" href="javascript:Pref.deleteCustomButton(\''+A+'\');void(0);" title="'+Klib.string("custombuttons.buttontable.delete")+'">'+Klib.sprites.buttonDelete.getHTML()+"</a></td>";
  5792. I+='<td><input id="CustomButton.'+B.id+'.enabled" preferenceid="CustomButton.'+B.id+'.enabled" type="checkbox" datatype="bool" /></td>'
  5793. }else{I+='<td></td><td style="text-align: left">'+A+"</td><td>"+Klib.string("custombuttons.buttontable.invalid")+"</td>"
  5794. }I+="</tr>"
  5795. }I+="</table>";
  5796. return I
  5797. };
  5798. Klib.CustomButtons.initPrefsDoc=function(C){var A=Klib.getEles("A.custombutton-edit-link",C);
  5799. for(var B=0;
  5800. B<A.length;
  5801. B++){Klib.addEvent(A[B],"click",function(D){D.halt();
  5802. var E=D.source.getAttribute("custombuttonid");
  5803. Klib.CustomButtons.openEditor(E)
  5804. })
  5805. }};
  5806. Klib.CustomButtons.remove=function(D,A){var B=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
  5807. try{B.deleteBranch("interclue.custombutton."+D)
  5808. }catch(C){}Klib.Pref.kill("CustomButton."+D+".enabled");
  5809. Klib.CustomButtons.init()
  5810. };
  5811. Klib.CustomButtons.getWin=function(){Klib.CustomButtons.safeEval("        window.err = {};        window.onerror = function(msg, file, line){            window.err.message = msg || '';            window.err.lineNumber = line || 0;        }        ");
  5812. return Klib.ClueBridge.getButtonFrame()
  5813. };
  5814. Klib.CustomButtons.safeEval=function(B){var C=Klib.ClueBridge.getButtonFrame().document;
  5815. var A=C.createElement("script");
  5816. A.type="text/javascript";
  5817. A.appendChild(C.createTextNode(B));
  5818. C.body.appendChild(A)
  5819. };
  5820. Klib.CustomButtons.generateButton=function(C){var E=Klib.CustomButtons.getWin();
  5821. if(E){E.Buttons=E.Buttons||{};
  5822. E.__btn__=null;
  5823. C="__btn__ = new function(){\n"+C+"\n}";
  5824. var D=Klib.getDoc(E);
  5825. var A=D.createElement("script");
  5826. A.type="text/javascript";
  5827. A.appendChild(D.createTextNode(C));
  5828. D.body.appendChild(A);
  5829. if(E.__btn__){E.Buttons[E.__btn__.id]=E.__btn__;
  5830. var B=E.__btn__
  5831. }else{if(E.err){var B={err:Klib.htmlspecialchars(E.err.message)+"\nLineNumber: "+Klib.htmlspecialchars(E.err.lineNumber)}
  5832. }}A.parentNode.removeChild(A);
  5833. return B
  5834. }else{return null
  5835. }};
  5836. Klib.CustomButtons.loadButton=function(){Klib.CustomButtons.openEditor("__doc__")
  5837. };
  5838. if(Klib.install("Regex",0.1)){Klib.KRegex=function(A){var B=this;
  5839. B.strExp=A;
  5840. B.regex=null;
  5841. B.init=function(){for(var C=0;
  5842. C<Klib.KRegex.expressions.length;
  5843. C++){var D=Klib.KRegex.expressions[C];
  5844. if(D.regexMatch.test(A)){B.type=D.type;
  5845. B.regex=D.regexCreate(A);
  5846. return 
  5847. }}if(!B.regex){Klib.error("Failed to create regex from str ["+A+"]")
  5848. }};
  5849. B.init()
  5850. };
  5851. Klib.KRegex.toRegexArr=function(A){var C=[];
  5852. for(var B=0;
  5853. B<A.length;
  5854. B++){var D=A[B];
  5855. if(D){C.push(new Klib.KRegex(D))
  5856. }}return C
  5857. };
  5858. Klib.KRegex.regex=function(B){var A=new Klib.KRegex(B);
  5859. return A.regex
  5860. };
  5861. Klib.KRegex.strToRegex=function(B){var A=new RegExp("^"+Klib.escapeRegExStr(B)+"$","i");
  5862. return A
  5863. };
  5864. Klib.KRegex.expressions=[];
  5865. Klib.KRegex.expressions.push({type:"regular expression",example:"/\d{1,2}-\d{1,2}-\d{4}/",regexMatch:/^\/.*\/(\w+)?$/,regexCreate:function(str){return eval(str)
  5866. }});
  5867. Klib.KRegex.expressions.push({type:"file",example:"*.js",regexMatch:/^\*\.\w[\.\w]*$/,regexCreate:function(B){var A=new RegExp("^(http|https|file):\\/\\/[^\\/]*\\/[^\\?#]*"+Klib.escapeRegExStr(B.substr(1))+"$","i");
  5868. return A
  5869. }});
  5870. Klib.KRegex.expressions.push({type:"protocol",example:"http:",regexMatch:/^\w+:(\*)?$/,regexCreate:function(B){var A=new RegExp("^"+Klib.escapeRegExStr(B)+".*$","i");
  5871. return A
  5872. }});
  5873. Klib.KRegex.expressions.push({type:"ipaddress",example:"192.168.*.*",regexMatch:/^((\d{1,3})|(\*))(\.(\d{1,3})|(\*)){3}$/,regexCreate:function(B){B=B.replace(/\*/g,"\\d{1,3}");
  5874. B=B.replace(/\./g,"\\.");
  5875. var A=new RegExp("^\\w+:(\\/)+"+B+"(\\/.*)?$","i");
  5876. return A
  5877. }});
  5878. Klib.KRegex.expressions.push({type:"domain",example:"example.com",regexMatch:/^(localhost)|([\w\-]+(\.[\w\-]+)+)$/,regexCreate:function(B){var A=new RegExp("^\\w+:(\\/)+[^\\/]*"+Klib.escapeRegExStr(B)+"(\\/.*)?$","i");
  5879. return A
  5880. }});
  5881. Klib.KRegex.expressions.push({type:"wildcard",example:"*blo??er*",regexMatch:/^.+$/,regexCreate:function(B){var A=new RegExp("^"+Klib.escapeRegExStr(B)+"$","i");
  5882. return A
  5883. }})
  5884. }if(Klib.install("Summary",0.1)){if(Klib.Cache){Klib.Summary.cache=new Klib.Cache.Obj("Summary")
  5885. }Klib.Summary.minSummaryLength=256;
  5886. Klib.Summary.MIN_WORD_COUNT=50;
  5887. Klib.Summary.precache=function(B,A){if(Klib.Pref.get("Summary.sendPrecacheRequests",false)){if(B.match(/^http:/ig)&&!Klib.Summary.cache.exists(B)){Klib.Summary.cache.add(B,true);
  5888. var C=new Klib.Ajax.Obj(Klib.getString("url.summaryserver.precache"));
  5889. C.onComplete=Klib.Summary.response;
  5890. C.addData("url",B);
  5891. C.addData("tier",A);
  5892. C.send()
  5893. }}};
  5894. Klib.Summary.initLink=function(A){Klib.addEvent(A,"mouseover",Klib.Summary.precacheLink)
  5895. };
  5896. Klib.Summary.cleanupLink=function(A){Klib.removeEvent(A,"mouseover",Klib.Summary.precacheLink)
  5897. };
  5898. Klib.Summary.precacheDoc=function(A){if(Klib.ClueBridge.lastDoc.URL){Klib.Summary.precache(Klib.ClueBridge.lastDoc.URL,1)
  5899. }};
  5900. Klib.Summary.precacheLink=function(A){var B=A.source;
  5901. if(Klib.Global.get("loggedIn")&&Klib.Pref.get("Summary.sendPrefetchRequest")&&B&&B.href&&B.href.match(/^http:/g)){Klib.Summary.precache(Klib.getFixedHref(B).toString(),2)
  5902. }Klib.removeEvent(B,"mouseover",Klib.Summary.precacheLink)
  5903. };
  5904. Klib.Summary.response=function(A){};
  5905. Klib.Summary.reportBadSummaryReceive=function(A){if(A.showResponse){if(!A.error){if(A.json.success){Klib.ClueFrame.alert("Thanks for the feedback.","Summary Report","",2000)
  5906. }else{Klib.ClueFrame.alert(A.json.msg,"Summary Report Error","error")
  5907. }}else{Klib.ClueFrame.alert("<p>Sorry, an error occured whilst trying to send the bad summary report.<p/><p>"+A.status+":"+A.statusText,"Summary Report Error","error")
  5908. }}};
  5909. Klib.Summary.toggleQFS=function(A){var B=A.source;
  5910. if(Klib.Pref.toggle("QFS.enabled")){B.value=Klib.getString("ajaxsummariser.button.disable.qfs");
  5911. Klib.Summary.reportBadSummary(true)
  5912. }else{B.value=Klib.getString("ajaxsummariser.button.enable.qfs")
  5913. }};
  5914. Klib.Summary.reportBadSummary=function(A){if(Klib.Clue.currentClue&&Klib.Clue.currentClue.link){var C=Klib.Clue.currentClue;
  5915. if(!Klib.Clue.isPrivateUrl(Klib.getFixedHref(C.link))){var B=new Klib.Ajax.Obj(Klib.getString("url.summaryserver.reportbadsummary"));
  5916. B.addData("loc",C.link.ownerDocument.URL);
  5917. B.addData("url",Klib.getFixedHref(C.link));
  5918. B.addData("qfs",Klib.Pref.get("QFS.enabled"));
  5919. B.addData("man",A);
  5920. B.addData("clueid",C.id);
  5921. B.isJson=true;
  5922. B.showResponse=A;
  5923. if(A){B.addData("uid",Klib.User.uid)
  5924. }B.onComplete=Klib.Summary.reportBadSummaryReceive;
  5925. B.send()
  5926. }}};
  5927. Klib.Summary.innerTextLen=function(A){var B=Klib.innerText(A,true,true);
  5928. B=B.replace(/&(#)?\w+(;)?/gi,".");
  5929. B=B.replace(/\s+/g,"");
  5930. return B.length
  5931. };
  5932. Klib.Summary.linkedTextRatio=function(H,B){var E=0;
  5933. var A=H.getElementsByTagName("a");
  5934. if(A.length>0){var C=B.replace(/\s+/g,"").length;
  5935. if(C>0){var G=0;
  5936. for(var D=0;
  5937. D<A.length;
  5938. D++){var F=A[D];
  5939. if(F.cachedInnerTextLen==undefined){F.cachedInnerTextLen=Klib.Summary.innerTextLen(F)
  5940. }G+=F.cachedInnerTextLen
  5941. }E=(G/C);
  5942. if(E<0){E=0
  5943. }if(E>1){E=1
  5944. }}else{ration=0
  5945. }}return E
  5946. };
  5947. Klib.Summary.isLayoutTable=function(C){var F=100;
  5948. var E=0;
  5949. var B=C.getElementsByTagName("td");
  5950. for(var A=0;
  5951. A<B.length;
  5952. A++){var D=Klib.Summary.innerTextLen(B[A]);
  5953. E=(D>E)?D:E
  5954. }return(E>=F)
  5955. };
  5956. Klib.Summary.convertTableToDivs=function(C){var B=C.innerHTML;
  5957. B=B.replace(/<(\/?)(tr|table|tbody|thead|tfoot)\b[^>]*>/ig,"");
  5958. B=B.replace(/<(\/?)(td|th)\b[^>]*>/ig,"<$1div>");
  5959. var D=C.ownerDocument.createElement("div");
  5960. var A=C.parentNode;
  5961. D.innerHTML=B;
  5962. A.insertBefore(D,C);
  5963. A.removeChild(C)
  5964. };
  5965. Klib.Summary.removeLinkLists=function(P){var Q=4;
  5966. var N=(24*1024);
  5967. var F=Klib.Pref.get("Clue.ajaxSummariser.textToLinkedTextRatio",0.5);
  5968. var I=10;
  5969. var A=Klib.getEles("div,p,ul,td,th,table,form",P);
  5970. Klib.profile("removeLinkLists-start",A.length+" blocks");
  5971. var L=Klib.timestamp(true)+Q;
  5972. var K=Klib.Pref.get("Summary.images");
  5973. for(var H=A.length-1;
  5974. H>=0;
  5975. H--){if(Klib.timestamp(true)>L){Klib.profile("Summary.removeLinkLists: time limit ["+Q+"s] exceeded: checked "+H+" of "+A.length+" blocks");
  5976. break
  5977. }var D=A[H];
  5978. if(D&&D.innerHTML.length<=N){var M=Klib.innerText(D,true,true);
  5979. if(Klib.wordCount(M)<I){var J;
  5980. if(K&&(J=D.getElementsByTagName("img"))&&J.length){var B=false;
  5981. for(var E=J.length-1;
  5982. E>=0;
  5983. E--){var G=J[E];
  5984. var O=Klib.getParent(G,"a");
  5985. if(!O||(O&&O.href&&O.href.match(/\b(gif|jpg|jpeg|png)\b/i))){B=true
  5986. }else{Klib.removeEle(G)
  5987. }}if(B){var C=D.innerHTML.match(/<img\b[^>]*>/g);
  5988. D.innerHTML=C.join("")
  5989. }else{D.innerHTML=""
  5990. }}else{D.innerHTML=""
  5991. }}else{if(Klib.Summary.linkedTextRatio(D,M)>F){D.innerHTML=""
  5992. }}}}Klib.profile("removeLinkLists-end")
  5993. };
  5994. Klib.Summary.replaceTablesWithDivs=function(A){var C=A.getElementsByTagName("table");
  5995. for(var B=C.length-1;
  5996. B>=0;
  5997. B--){if(Klib.Summary.isLayoutTable(C[B])){Klib.Summary.convertTableToDivs(C[B])
  5998. }}};
  5999. Klib.Summary.getWords=function(F,A){var E=0;
  6000. var D="";
  6001. while(F&&(E<A)){var C=F.match(/^[\w-_\.]+/);
  6002. var B=F.match(/^[^\w-_\.]+/);
  6003. if(C){E++;
  6004. D+=C[0];
  6005. F=F.substr(C[0].length)
  6006. }else{if(B){D+=B[0];
  6007. F=F.substr(B[0].length)
  6008. }else{break
  6009. }}}return D
  6010. };
  6011. Klib.Summary.reduceToMaxWordCount=function(C,G){if(!G){return C
  6012. }var F="";
  6013. var E=0;
  6014. while((C.length>0)&&(E<G)){var A=C.match(/^<\/?\w+[^>]*>/);
  6015. var D=C.match(/^([^<]|(<[^\w\/]))+/);
  6016. if(A){F+=A[0];
  6017. C=C.substr(A[0].length)
  6018. }else{if(D){var B=Klib.wordCount(D[0]);
  6019. if((E+B)>G){F+=Klib.Summary.getWords(D[0],(G-E))+"...";
  6020. break
  6021. }else{F+=D[0];
  6022. E+=B;
  6023. C=C.substr(D[0].length)
  6024. }}else{Klib.error("Unknown html segment. not tag or text?",C);
  6025. break
  6026. }}}return F
  6027. };
  6028. Klib.Summary.removeFormElements=function(B){var A=B.innerHTML;
  6029. A=A.replace(/<(select|button|textarea)\b[\w\W]*?<\/(select|button|textarea)[^>]*>/ig," ");
  6030. A=A.replace(/<input[^>]*>/ig," ");
  6031. B.innerHTML=A
  6032. };
  6033. Klib.Summary.preToDiv=function(A){var B=Klib.trim(Klib.innerText(A));
  6034. A.innerHTML=Klib.Summary.textToHTML(B)
  6035. };
  6036. Klib.Summary.textToHTML=function(B,C){if(!C){B=B.replace(/</g,"<")
  6037. }B=B.replace(/(\r\n|\r|\n)\s*(\r\n|\r|\n)/g,"<br /><br />");
  6038. B=B.replace(/\t/g,"    ");
  6039. while(1){var A=B.match(/^\s*((\d\.|\*\s)(.*))$/m);
  6040. if(A){B=B.replace(A[0],"\n<li>"+A[1]+"</li>")
  6041. }else{break
  6042. }}B=B.replace(/<\/li>\s+<li>/mg,"</li><li>");
  6043. B=B.replace(/^<li>/mg,'<ul style="list-style-type: none"><li>');
  6044. B=B.replace(/<\/li>([^<])/g,"</li></ul>$1");
  6045. B=B.replace(/\s+/g," ");
  6046. return B
  6047. };
  6048. Klib.Summary.fixPreTags=function(B){var C=B.getElementsByTagName("pre");
  6049. for(var A=0;
  6050. A<C.length;
  6051. A++){Klib.Summary.preToDiv(C[A])
  6052. }};
  6053. Klib.Summary.debug=function(B,A){Klib.profile(B,A);
  6054. if(Klib.Summary.debug.testString){if(A.indexOf(Klib.Summary.debug.testString)==-1){debug("test string ["+Klib.Summary.debug.testString+'] not found directly after "'+B+'"');
  6055. Klib.Summary.debug.testString=""
  6056. }}};
  6057. Klib.Summary.debugSummaryForClue=function(A){Klib.ClueBridge.openUrl(Klib.baseUrl+"/debug/summary.html?url="+Klib.getFixedHref(A.link),true,true,true)
  6058. };
  6059. Klib.Summary.extractSummaryPrepareDocument=function(B,A){if(A){Klib.Summary.debug("[ajaxsummariser-start]",B.body.innerHTML)
  6060. }Klib.Summary.removeFormElements(B.body);
  6061. if(A){Klib.Summary.debug("[removeFormElements]",B.body.innerHTML)
  6062. }Klib.Summary.replaceTablesWithDivs(B.body);
  6063. if(A){Klib.Summary.debug("[replaceTablesWithDivs]",B.body.innerHTML)
  6064. }Klib.Summary.fixPreTags(B.body);
  6065. if(A){Klib.Summary.debug("[fixPreTags]",B.body.innerHTML)
  6066. }return B
  6067. };
  6068. Klib.Summary.groupImages=function(E,D,B){Klib.SUMMARY_IMAGES_MIN_TEXT_LENGTH_BETWEEN_IMAGES=10;
  6069. var A=null;
  6070. var F=null;
  6071. var C=function(H){var G=0;
  6072. while(1){var J=H.childNodes[G];
  6073. if(!J){break
  6074. }if(Klib.isEle(J,"img")){if(A){A.appendChild(J);
  6075. G--
  6076. }else{var I=H.ownerDocument.createElement("div");
  6077. I.className="summary-image-block";
  6078. H.insertBefore(I,J);
  6079. I.appendChild(J);
  6080. A=I;
  6081. F=J
  6082. }}else{if(A&&(J.nodeType==Klib.NODE_TYPE_TEXT)){if(Klib.trim(J.data.replace(/ (;)?/ig,"")).length>=Klib.SUMMARY_IMAGES_MIN_TEXT_LENGTH_BETWEEN_IMAGES){A=null
  6083. }}}if(J.childNodes){C(J)
  6084. }G++
  6085. }};
  6086. C(E)
  6087. };
  6088. Klib.Summary.removeDuplicateBlocks=function(G){var B=16;
  6089. var A=Klib.getEles("div,h1,h2,h3,h4,h5,h6,ul,td,th",G);
  6090. var E={};
  6091. for(var D=0;
  6092. D<A.length;
  6093. D++){var F=A[D];
  6094. if(F){var C=F.innerHTML;
  6095. if(C&&G.title&&(C==G.title)){Klib.removeEle(F)
  6096. }else{if(C&&(C.length>B)){if(E[C]){Klib.removeEle(F);
  6097. return 
  6098. }E[C]=F
  6099. }else{if(!C&&!Klib.Html.isClosedTag(F.tagName.toLowerCase())){Klib.removeEle(F)
  6100. }}}}}};
  6101. Klib.Summary.cleanSummary=function(A,B){A=A.replace(/<(\/?)(center)\b[^>]*>/ig,"");
  6102. if(B){Klib.Summary.debug("[removeCenters]",A)
  6103. }A=Klib.Html.removeEmptyTags(A);
  6104. if(B){Klib.Summary.debug("[removedEmptyTags]",A)
  6105. }A=A.replace(/(\s*<br\b[^>]*>\s*<br\b[^>]*>)\s*(\s*<br\b[^>]*>\s*)*/ig,"<br /><br />");
  6106. if(B){Klib.Summary.debug("[replaceMultipleLineBreaks]",A)
  6107. }A=A.replace(/(\s| |<br[^>]*>)*(<img[^>]*>)(\s| |<br[^>]*>)*/ig,"$2");
  6108. if(B){Klib.Summary.debug("[removedWhitespaceAroundImages]",A)
  6109. }A=Klib.trim(A);
  6110. if(B){Klib.Summary.debug("[trim]",A)
  6111. }return A
  6112. };
  6113. Klib.Summary.extractSummaryGenerateSummary=function(B,A){Klib.Summary.removeLinkLists(B);
  6114. if(A){Klib.Summary.debug("[removeLinkLists]",B.body.innerHTML)
  6115. }Klib.Summary.groupImages(B.body);
  6116. if(A){Klib.Summary.debug("[groupImages]",B.body.innerHTML)
  6117. }Klib.Summary.removeDuplicateBlocks(B);
  6118. if(A){Klib.Summary.debug("[removeDuplicateBlocks]",B.body.innerHTML)
  6119. }return Klib.Summary.cleanSummary(B.body.innerHTML,A)
  6120. };
  6121. Klib.Summary.extractSummary=function(C,B,A){Klib.Summary.debug.testString=A||"";
  6122. Klib.Summary.extractSummaryPrepareDocument(C,B,A);
  6123. return Klib.Summary.extractSummaryGenerateSummary(C,B,A)
  6124. }
  6125. }if(Klib.install("Window",0.1)){Klib.Windows={};
  6126. Klib.Window.loading=function(C,A){var B=C.getElementById("overlay");
  6127. if(B){Klib.setStyle(B,"display",(A?"block":"none"))
  6128. }};
  6129. Klib.Window.open=window.open;
  6130. Klib.Window.close=function(D,B){if(typeof D=="string"){if(D=="*"){for(var A in Klib.Windows){if(Klib.Windows[A].close){try{Klib.Windows[A].close()
  6131. }catch(C){}}}}else{if(Klib.Windows[D]){D=Klib.Windows[D].win
  6132. }else{Klib.error("Unable to find window",D);
  6133. D=null
  6134. }}}if(!D){return 
  6135. }if(!B){if(D.document){D.document.write("<script>window.close();<\/script>")
  6136. }else{if(D.close){D.close()
  6137. }else{Klib.warning("Unable to find close function for window",D)
  6138. }}}B=B||1;
  6139. window.setTimeout(function(){try{D.close()
  6140. }catch(E){}},B)
  6141. };
  6142. Klib.KWindow=function(A){var B=this;
  6143. B.errorCount=0;
  6144. if(Klib.Windows[A]){var B=Klib.Windows[A];
  6145. if(!B.exists()){B.win=null;
  6146. B.winReady=false;
  6147. B.chromeWin=null;
  6148. B.chromeWindowReady=false
  6149. }}else{Klib.Windows[A]=B;
  6150. B.name=A;
  6151. B.features="location=no,menubar=no,resizable=yes,status=no,titlebar=yes";
  6152. B.win=null;
  6153. B.INIT_WINDOW_SLEEP_TIME=1000;
  6154. B.useChromeDialog=false;
  6155. B.chromeUrl="";
  6156. B.chromeWin=null;
  6157. B.attempts=0;
  6158. B.maxAttempts=(Klib.platform=="firefox")?12:6;
  6159. B.lastError=null;
  6160. B.exists=function(){try{return(B.win&&!B.win.closed)
  6161. }catch(C){}return false
  6162. };
  6163. B.close=function(C){if(C){Klib.setTimer(B.close,C)
  6164. }else{try{B.chromeWin.close()
  6165. }catch(D){}try{B.win.close()
  6166. }catch(D){}try{this.win.document.write('<script type="text/javascript">window.close();<\/script>')
  6167. }catch(D){}}};
  6168. B.open=function(C,D,K,E,G){var H=Klib.Windows[B.name];
  6169. if(H&&H.exists()){H.win.focus()
  6170. }else{B.url=C||"about:blank";
  6171. B.width=D||640;
  6172. B.height=K||480;
  6173. B.onDocumentExists=G||null;
  6174. B.features+=(E)?","+E:"";
  6175. var I=B.calculatePosition();
  6176. B.features+=",width="+D+",height="+K+",left="+I.left+",top="+I.top;
  6177. B.attempts=0;
  6178. if(B.useChromeDialog&&(Klib.platform=="firefox")){B.chromeUrl="chrome://interclue/content/dialog.xul?url="+B.url;
  6179. B.features+=",chrome=yes,dependent=yes";
  6180. B.chromeWindowReady=false;
  6181. B.chromeWin=window.open(B.chromeUrl,B.name,B.features)
  6182. }else{if(B.useChromeDialog&&(Klib.platform=="IEToolbar")&&(B.url!="about:blank")){if(Klib.Dialogs[B.name]){B.winReady=false;
  6183. B.chromeWin=Klib.Window.open(Klib.baseUrl+"/blank.html",B.name,B.features);
  6184. var F=Klib.Dialog.buildDialogHtml(B.name);
  6185. var J=B.chromeWin.document;
  6186. J.open("text/html","replace");
  6187. J.write(F);
  6188. J.close();
  6189. J=B.chromeWin.document;
  6190. J.origUrl=B.url;
  6191. B.win=Klib.getWin(J);
  6192. B.win.close=function(){B.chromeWin.quit()
  6193. }
  6194. }else{throw Error("Interclue:window: No page built for "+B.name)
  6195. }}else{B.winReady=false;
  6196. B.win=window.open(B.url,B.name,B.features)
  6197. }}B.creatingWindow()
  6198. }};
  6199. B.creatingWindow=function(){if(B.chromeWin&&B.useChromeDialog&&!B.chromeWindowReady){var E=B.chromeWin.document;
  6200. if(E){var C=E.getElementById("interclue-dialog-iframe");
  6201. if(C&&(C.getAttribute("src")!="about:blank"||B.url=="about:blank")&&C.contentWindow){B.win=C.contentWindow;
  6202. B.win.alert=function(F){return B.chromeWin.alert(F)
  6203. };
  6204. B.win.confirm=function(F){return B.chromeWin.confirm(F)
  6205. };
  6206. B.win.close=function(){return B.chromeWin.close()
  6207. };
  6208. B.win.opener=B.chromeWin.opener;
  6209. if(B.win.document&&B.win.title){B.chromeWin.document.title=Klib.translate(B.win.title)
  6210. }B.win.setTitle=function(F){if(B.chromeWin&&B.chromeWin.document){B.chromeWin.document.title=F
  6211. }if(B.win&&B.win.document){B.win.document.title=F
  6212. }};
  6213. B.chromeWindowReady=true
  6214. }else{if(C){}else{}}}else{}}if(B.win&&!B.winReady){if(!B.win.initalizing){B.win.initalizing=true;
  6215. try{B.winReady=B.onDocumentExists?B.onDocumentExists(B.win):true
  6216. }catch(D){B.errorCount++;
  6217. if(B.errorCount>1){Klib.warning("kWin.onDocumentExists Error:",D,B.onDocumentExists.toString())
  6218. }B.lastError=D;
  6219. B.winReady=false
  6220. }B.win.initalizing=false
  6221. }}if(!B.winReady){B.attempts++;
  6222. if(B.attempts<B.maxAttempts){if(B.attempts>1){}Klib.setTimer(B.creatingWindow,B.INIT_WINDOW_SLEEP_TIME)
  6223. }else{B.error("Failed to create window within allotted time",parseInt(B.maxAttempts/(1000/B.INIT_WINDOW_SLEEP_TIME))+" seconds");
  6224. B.close();
  6225. alert("Sorry, an error occured whilst initalizing the window.\nUnable to open "+B.name);
  6226. throw B.lastError
  6227. }}else{}};
  6228. B.calculatePosition=function(){var E=0;
  6229. var D=0;
  6230. switch(B.position){case"centerwindow":default:var C=Klib.getRect(window);
  6231. E=parseInt((C.left+(C.width/2))-(B.width/2));
  6232. D=parseInt((C.top+(C.height/2))-(B.height/2));
  6233. break
  6234. }return Klib.rect(E,D,B.width,B.height)
  6235. };
  6236. B.error=function(C){Klib.error("KWindow error",B.name,B.url,C,B.lastError)
  6237. }
  6238. }return B
  6239. }
  6240. }if(Klib.install("Html",0.1)){Klib.Html.tag=function(E,B){E=E.toLowerCase();
  6241. var D="<"+E;
  6242. for(var C in B){if(B[C]!==null){D+=" "+C+'="'+Klib.htmlspecialchars(B[C])+'"'
  6243. }}var A=["base","basefont","br","col","frame","hr","img","input","isindex","link","meta","param"];
  6244. D+=(Klib.inArray(E,A))?" />":"></"+E+">";
  6245. return D
  6246. };
  6247. Klib.Html.getEleHTML=function(B,E){E=E||document;
  6248. var D="";
  6249. var A=Klib.getEles(B,E);
  6250. for(var C=0;
  6251. C<A.length;
  6252. C++){D+=Klib.outerHTML(A[C])
  6253. }return D
  6254. };
  6255. Klib.Html.toText=function(A){A=Klib.Html.clean(A);
  6256. var B=A.replace(/\s*<\/((h\d)|p)\s*>\s*/ig,"{br}{br}");
  6257. B=B.replace(/\s*<(\/div)\b[^>]*>\s*/ig,"{br}");
  6258. B=B.replace(/\s*<(li)\b[^>]*>\s*/ig,"{br} * ");
  6259. B=B.replace(/<[^>]*>/g," ");
  6260. B=Klib.trim(B,true);
  6261. B=B.replace(/\s+/g," ");
  6262. B=B.replace(/(\s*\{br\}){2,}/g,"{br}{br}");
  6263. B=B.replace(/\s*\{br\}\s*/g,"\n");
  6264. B=Klib.trim(B);
  6265. return B
  6266. };
  6267. Klib.Html.stripTags=function(A){return Klib.trim(A.replace(/<[^>]*>/gm,""))
  6268. };
  6269. Klib.Html.addBaseTarget=function(A,B){var C=/(<base\b[^>]*)(target\s*=\s*(("[^"]*")|('[^']*')|([^\s]*)))([^>]*>)/i;
  6270. if(A.match(C)){return A.replace(C,'$1 target="'+B+'" $7')
  6271. }C=/(<base\b)([^>]*>)/i;
  6272. if(A.match(C)){return A.replace(C,'$1 target="'+B+'" $2')
  6273. }C=/(<head\b[^>]*>)/i;
  6274. if(A.match(C)){return A.replace(C,'$1 <base target="'+B+'" />')
  6275. }else{return'<base target="'+B+'" />'+A
  6276. }};
  6277. Klib.Html.extractBaseHref=function(B,A){var C=B.match(/<base\b[^>]*\bhref\s*=\s*(("[^"]*")|('[^']*')|([^\s]*))[^>]*>/i);
  6278. if(C){A=C[1].replace(/["']/g,"")
  6279. }A=A.replace(/#.*$/,"");
  6280. A=A.replace(/\?.*$/,"");
  6281. A=A.replace(/\/[^\/]*$/,"")+"/";
  6282. return A
  6283. };
  6284. Klib.Html.extractCharset=function(A){var B=A.match(/<meta[^>]*\bcharset\s*=\s*([\w\-]*)/i);
  6285. return(B)?B[1]:""
  6286. };
  6287. Klib.Html.fixRelativePaths=function(B,A){var C=Klib.Html.extractBaseHref(B,A);
  6288. B=B.replace(/(<[^>]*\b_?(href|src)\s*)((=\s*["']?)([^{"'\/]((\w+\b[^:])|[^\w])))/ig,"$1$4"+C+"$5");
  6289. var D=C.replace(/(\w+:\/\/[^\/]*)\/.*/,"$1");
  6290. B=B.replace(/(<[^>]*\b_?(href|src)\s*)((=\s*["']?)([^{"']((\w+\b[^:])|[^\w])))/ig,"$1$4"+D+"$5");
  6291. return B
  6292. };
  6293. Klib.Html.clean=function(A){A=A.replace(/<!--[\w\W]*?-->/gm,"");
  6294. A=A.replace(/<!--[\w\W]*?$/gm,"");
  6295. A=A.replace(/(<(textarea|iframe|script|style|noscript|noembed|noframes|nolayer|nostyle)\b[^>]*>)([\w\W]*?)(<\/(\2)[^>]*>)/igm,"$1</$2>");
  6296. A=A.replace(/<(textarea|iframe|script|style|noscript|noembed|noframes|nolayer|nostyle)\b[^>]*>[^<][\w\W]*$/igm,"");
  6297. A=A.replace(/\s([\w\-:][\w\-_:]*\s*=\s*)/gm," _$1");
  6298. return A
  6299. };
  6300. Klib.Html.compressWhitespace=function(A){A=A.replace(/\s+/g," ");
  6301. A=A.replace(/^\s+|\s+$/g,"");
  6302. return A
  6303. };
  6304. Klib.Html.removeBlockTags=function(B,A){var C=new RegExp("<("+A+")\\b[\\w\\W]*?<\\/\\1[^>]*>","igm");
  6305. B=B.replace(C," ");
  6306. C=new RegExp("<("+A+")\\b[^>]*>[^<][\\w\\W]*$","igm");
  6307. B=B.replace(C,"");
  6308. return B
  6309. };
  6310. Klib.Html.isBlockTag=function(A){return(",blockquote,br,dd,div,form,fieldset,fieldset.h2.h3.h4.h5.h6,hr,li,p,tr,th,td,".indexOf(","+A+",")!=-1)
  6311. };
  6312. Klib.Html.isClosedTag=function(A){return(",base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,".indexOf(","+A+",")!=-1)
  6313. };
  6314. Klib.Html.removeTags=function(B,A){if(A=="*"){A="\\w+"
  6315. }var C=new RegExp("<(\\/)?("+A+")\\b(('[^']*')|(\"[^\"]*\")|([^>]))*>","ig");
  6316. return B.replace(C," ")
  6317. };
  6318. Klib.Html.removeEmptyTags=function(C){var B=10;
  6319. var A=0;
  6320. var D=/<(\w+)[^>]*>(( (;)?)|\s)*<\/(\1)>/ig;
  6321. while(D.test(C)&&(A++<B)){C=C.replace(D," ")
  6322. }return C
  6323. };
  6324. Klib.Html.removeAttributes=function(E,B){var G=E.match(/(<\/?[a-zA-Z]+[^>]*>)((<[^\/a-zA-Z])|([^<]))*/g);
  6325. var F=new RegExp("(\\b("+B+")\\b(\\s*=\\s*(('[^']*')|(\"[^\"]*\")|([^\\s]*)))?\\s*)+","ig");
  6326. E="";
  6327. if(G){for(var D=0;
  6328. D<G.length;
  6329. D++){var C=G[D].split(">",2);
  6330. var A=C[0].substr(1);
  6331. C[0]=A.replace(F,"");
  6332. E+="<"+C[0]+">"+C[1]
  6333. }}return E
  6334. };
  6335. Klib.Html.fixRelativeUrls=function(G){var A=Klib.getEles("a,img",G);
  6336. for(var E=0;
  6337. E<A.length;
  6338. E++){var F=A[E];
  6339. if(F.src&&F.src.toString){var H=F.src.toString();
  6340. var C=F.getAttribute("src");
  6341. if(C!=H){F.setAttribute("src",H)
  6342. }}if(F.href&&F.href.toString){var B=F.href.toString();
  6343. var D=F.getAttribute("href");
  6344. if(D!=B){F.setAttribute("href",B)
  6345. }}}};
  6346. Klib.Html.removeFormElements=function(A){A=Klib.Html.removeBlockTags(A,"select|button|textarea");
  6347. A=Klib.Html.removeTags(A,"input|form");
  6348. return A
  6349. };
  6350. Klib.Html.getInnerBlock=function(B,F){var C=new RegExp("<\\/"+F+"[^>]*>","i");
  6351. var E=B.search(C);
  6352. var D=B.match(C);
  6353. var A=D?D[0]:false;
  6354. if(E&&A){var G=B.toLowerCase().lastIndexOf("<"+F,E);
  6355. if(G==-1){Klib.warning("start tag not found",B,F)
  6356. }else{if(G>E){Klib.warning("end tag before start tag",B,F)
  6357. }else{return B.substr(G,(E-G))+A
  6358. }}}else{}return false
  6359. };
  6360. Klib.Html.frameSizeToPixels=function(A,D){var C=parseInt(A);
  6361. var B=A.replace(/[\d\.\s]*/g,"");
  6362. if(isNaN(C)||C<1){C=1
  6363. }switch(B){case"*":return C*D;
  6364. case"%":return(C/100)*D;
  6365. default:return C
  6366. }};
  6367. Klib.Html.frameObj=function(){var A=this;
  6368. A.width=0;
  6369. A.height=0;
  6370. A.src="";
  6371. A.area=0
  6372. };
  6373. Klib.Html.extractBiggestFrameFromFrameset=function(G){var B=G.match(/<frameset\b([^>]*)>([\w\W]*?)<\/frameset\b[^>]*>/i);
  6374. if(B){var A=B[0].match(/<frame\b([^>]*)>/ig);
  6375. var D=[];
  6376. for(var F=0;
  6377. F<A.length;
  6378. F++){var I=new Klib.Html.frameObj();
  6379. I.src=Klib.Html.getAttrValue(A[F],"src");
  6380. D.push(I)
  6381. }var H=(Klib.Html.getAttrValue(B[1],"cols")||"100%").split(/\s*,\s*/g);
  6382. var K=(Klib.Html.getAttrValue(B[1],"rows")||"100%").split(/\s*,\s*/g);
  6383. for(var F=0;
  6384. F<H.length;
  6385. F++){H[F]=Klib.Html.frameSizeToPixels(H[F],800)
  6386. }for(var F=0;
  6387. F<K.length;
  6388. F++){K[F]=Klib.Html.frameSizeToPixels(K[F],600)
  6389. }for(var F=0;
  6390. F<D.length;
  6391. F++){var C=(F%H.length);
  6392. var J=Math.floor(F/H.length);
  6393. D[F].width=H[C];
  6394. D[F].height=K[J];
  6395. D[F].area=H[C]*K[J]
  6396. }var E=D[0];
  6397. for(var F=1;
  6398. F<D.length;
  6399. F++){if(D[F].area>E.area){E=D[F]
  6400. }}return E
  6401. }else{}return false
  6402. };
  6403. Klib.Html.getAttrValue=function(B,A){var C=new RegExp("\\b_?("+A+")\\b\\s*=\\s*(\"([^\"]*)\"|'([^']*)'|([\\w\\-_\\,\\%\\*]*))","i");
  6404. var D=B.match(C);
  6405. if(D){return D[3]||D[4]||D[5]
  6406. }else{return false
  6407. }};
  6408. Klib.Html.findLargestFrame=function(E,D){E=Klib.Html.fixRelativePaths(E,D);
  6409. var C=10;
  6410. var A=null;
  6411. var G=0;
  6412. while(G<C){var F=Klib.Html.getInnerBlock(E,"frameset");
  6413. if(F){G++;
  6414. A=Klib.Html.extractBiggestFrameFromFrameset(F);
  6415. var B='<frame src="'+A.src+'" />';
  6416. E=E.replace(F,B)
  6417. }else{break
  6418. }}return A
  6419. };
  6420. Klib.Html.extractAnchorSegment=function(K,B){var E=K.body.innerHTML;
  6421. var J=new RegExp("<[^<]+\\b(id|name)\\s*=\\s*([\"'])?"+Klib.escapeRegExStr(B)+"\\b","i");
  6422. var H=E.search(J);
  6423. if(H>-1){var J=new RegExp("<[^<]+\\b(id|name)\\s*=\\s*([\"'])?\\w+","img");
  6424. var F=[];
  6425. var C=0;
  6426. J.lastIndex=H+1;
  6427. var I=Klib.Pref.get("Clue.anchorExternal.minWords");
  6428. while(C<I){var D=J.exec(E);
  6429. if(D){var A=J.lastIndex-D[0].length;
  6430. var G=E.substring(H,A);
  6431. C+=Klib.wordCount(G,true);
  6432. F.push(G);
  6433. H=A;
  6434. J.lastIndex++
  6435. }else{F.push(E.substr(H));
  6436. break
  6437. }}return F.join("")
  6438. }else{Klib.warning("Html.extractAnchorSegment: anchor not found",B,K.URL);
  6439. return""
  6440. }};
  6441. Klib.Html.extractAnchorSegment2=function(K,E){function I(O,N){var L=N.getElementsByTagName("*");
  6442. for(var M=0;
  6443. M<L.length;
  6444. M++){if(L[M]==O){return true
  6445. }}return false
  6446. }function C(N,M,L){if(N.tagName.toLowerCase()==M.toLowerCase()){if((L=="name")&&(N.getAttribute("name"))){return true
  6447. }if((L=="id")&&(N.getAttribute("id"))){return true
  6448. }}return false
  6449. }function A(Q,P,M){var O=[];
  6450. var L=Q.getElementsByTagName(P);
  6451. for(var N=0;
  6452. N<L.length;
  6453. N++){if(C(L[N],P,M)){O.push(L[N])
  6454. }}return O
  6455. }function H(P,L){var M=[];
  6456. for(var N=0;
  6457. N<P.childNodes.length;
  6458. N++){var O=P.childNodes[N];
  6459. if(O==L){M.push("<!--start-->")
  6460. }if(O.nodeType==1&&O.childNodes){if(O.childNodes.length){M.push(O);
  6461. M=M.concat(H(O,L));
  6462. M.push("</"+O.nodeName+">")
  6463. }else{switch(O.nodeName.toLowerCase()){case"a":M.push(O);
  6464. M.push("</"+O.nodeName+">");
  6465. break;
  6466. case"hr":case"br":M.push("<"+O.nodeName+" />");
  6467. break;
  6468. default:break
  6469. }}}else{if(O.nodeType==3){M.push(O)
  6470. }else{}}}return M
  6471. }function B(Y,X,T){var L=H(Y,X);
  6472. var Q="";
  6473. var P=0;
  6474. var U=false;
  6475. var N=false;
  6476. var R=X.nodeName;
  6477. var V=X.getAttribute("name")?"name":"id";
  6478. for(var O=0;
  6479. O<L.length;
  6480. O++){var M=L[O];
  6481. if(M=="<!--start-->"){U=true
  6482. }else{if(U){if(typeof M=="string"){Q+=M
  6483. }else{if(M.nodeType==1){if((P>T)&&(M.nodeName==R)&&M.getAttribute(V)){return Q
  6484. }else{var W=M.nodeName.toLowerCase();
  6485. var S=(W=="a"&&M.href)?' href="'+Klib.htmlspecialchars(M.href)+'" ':"";
  6486. Q+="<"+W+S+">"
  6487. }}else{if(M.nodeType==3){Q+=Klib.htmlspecialchars(M.data);
  6488. P+=Klib.wordCount(M.data)
  6489. }}}}}}if(Y.parentNode&&(P<T)){return B(Y.parentNode,X,T)
  6490. }else{return Q
  6491. }}var G=K.getElementById(E);
  6492. var F="";
  6493. if(G){F="id"
  6494. }else{if(K.getElementsByName(E)){G=K.getElementsByName(E)[0];
  6495. F="name"
  6496. }}if(!G){Klib.warning("Klib.Html.extractAnchorSegment: Failed to find anchor",E);
  6497. return false
  6498. }var D=G.parentNode;
  6499. var J=null;
  6500. while(D&&A(D,G.tagName,F).length<2){D=D.parentNode
  6501. }if(!D){D=G.parentNode
  6502. }return B(D,G,Klib.Pref.get("Clue.anchorExternal.minWords",200))
  6503. }
  6504. }Klib.HTMLParser=function(){var B=this;
  6505. function A(C){return Klib.arrayToObject(C.split(/\s*,\s*/))
  6506. }B.allowedTags=A("a,abbr,acronym,address,b,base,big,blockquote,body,br,button,caption,center,cite,code,col,colgroup,dd,del,div,dl,dt,em,fieldset,font,form,h1,h2,h3,h4,h5,h6,head,html,hr,i,img,input,label,legend,li,link,meta,ol,optgroup,option,p,pre,q,s,select,small,span,strike,strong,sub,sup,table,tbody,td,textarea,thead,title,tfoot,th,tr,tt,u,ul,var,wbr");
  6507. B.closedTags=A("base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,wbr");
  6508. B.allowedAttributes={id:A("*"),"class":A("*"),name:A("*"),href:A("a"),cite:A("blockquote"),src:A("img"),width:A("img"),height:A("img"),value:A("input,option"),alt:A("img"),title:A("img")};
  6509. B.urlAttributes=A("href,src,cite");
  6510. B.allowedProtocols="http,https,ftp,aim,icq,mailto";
  6511. B.meta={};
  6512. B.pixel=(Klib.Image)?Klib.Image.pixel():"pixel.gif";
  6513. B.NODE_TYPE_ELEMENT=1;
  6514. B.NODE_TYPE_TEXT=3;
  6515. B.origText="";
  6516. B.text="";
  6517. B.cleanHTML="";
  6518. B.tags={};
  6519. B.feeds=[];
  6520. B.origLength=0;
  6521. B.parsedLength=0;
  6522. B.parsedPercent=0;
  6523. B.success=false;
  6524. B.stopped=false;
  6525. B.cleanWhitespace=true;
  6526. B.microsummaryUrl=false;
  6527. B.testString="";
  6528. B.initUrl=function(C,E){var G;
  6529. if(C){B.url=C;
  6530. B.urlPage=B.url.replace(/#.*$/,"");
  6531. B.urlDoc=B.urlPage.replace(/[^\/\\]*$/,"");
  6532. var F="";
  6533. G=E.match(/<base\b[^>]*\bhref\s*=\s*(("([^"]*)")|('([^']*)')|([^\s\/>]*))/i);
  6534. if(G){var D=G[3]||G[5]||G[6];
  6535. if(D.match(/http(s)?:\/\//)){F=D
  6536. }}if(!F){G=B.urlDoc.match(/^(\w+:(\/)+[^\/]+)\//);
  6537. if(G){F=G[0]
  6538. }else{throw Error("Unable to parse url "+C)
  6539. }}F=F.replace(/#.*$/,"");
  6540. F=F.replace(/\?.*$/,"");
  6541. F=F.replace(/[^\/]*$/,"");
  6542. if(F.substr(F.length-1)!="/"){F+="/"
  6543. }B.urlBase=F
  6544. }else{throw Error("Url is required")
  6545. }};
  6546. B.validateUrl=function(C){C=Klib.trim(C);
  6547. if(!C){return null
  6548. }if(C.match(B.regexProtocols)){return C
  6549. }else{if(C.match(/^\w+:/)){return null
  6550. }else{var D=C.substr(0,1);
  6551. switch(D){case"#":case"?":return B.urlPage+C;
  6552. case"/":return B.urlBase+C.substr(1);
  6553. default:break
  6554. }return B.urlDoc+C
  6555. }}};
  6556. B.renderUnsafePage=function(F){if(B.testString&&(F.indexOf(B.testString)==-1)){debug('"'+B.testString+'" not found BEFORE renderUnsafePage');
  6557. B.testString=""
  6558. }if(Klib.platform=="firefox"){var E="";
  6559. var D="";
  6560. var C=F.match(/<body[^>]*>/i);
  6561. if(C){var H=F.indexOf(C[0]);
  6562. E=F.substr(0,H).replace(/<(\/)?(html|head)[^>]*>/ig,"");
  6563. D=F.substr(H+C[0].length)
  6564. }else{D=F
  6565. }B.doc.getElementsByTagName("head")[0].innerHTML=E;
  6566. B.doc.body.innerHTML=D
  6567. }else{B.doc.open("text/html","replace");
  6568. B.doc.write(F);
  6569. B.doc.close();
  6570. if(B.testString&&(B.doc.body.innerHTML.indexOf(B.testString)==-1)){debug('"'+B.testString+'" not found after writing to document (HTMLParser.renderUnsafePage)');
  6571. B.testString=""
  6572. }}try{Klib.getWin(B.doc).stop()
  6573. }catch(G){}try{B.doc.execCommand("Stop")
  6574. }catch(G){}};
  6575. B.tagContainsText=function(C){return(",option,textarea,select,script,style,".indexOf(","+C+",")==-1)
  6576. };
  6577. B.isBlockTag=function(C){return(",blockquote,br,dd,div,form,fieldset,fieldset.h2.h3.h4.h5.h6,hr,li,p,tr,th,td,".indexOf(","+C+",")!=-1)
  6578. };
  6579. B.extractText=function(C){return C.replace(/ _([\w\-:][\w\-_:]*\s*=\s*)/gm," $1")
  6580. };
  6581. B.initResourceStats=function(){B.resources={};
  6582. B.resources.images=[];
  6583. B.resources.stylesheets=[];
  6584. B.resources.scripts=[];
  6585. B.resources.documents=[];
  6586. B.resources.media=[]
  6587. };
  6588. B.extractSafeHTML=function(J){if(Klib.timestamp(true)>B.timeout){B.stopped=true
  6589. }if(B.stopped){return""
  6590. }var I="";
  6591. var S=J.tagName.toLowerCase();
  6592. if(!B.bodyfound&&S=="body"){B.bodyfound=true;
  6593. B.origText=""
  6594. }B.tagCount++;
  6595. B.tags[S]=B.tags[S]||0;
  6596. B.tags[S]++;
  6597. if(S=="meta"){var Q=J.getAttribute("_name");
  6598. if(Q){B.meta[Q.toLowerCase()]=J.getAttribute("_content")
  6599. }}if(S=="link"){var H=J.getAttribute("_type");
  6600. var D=J.getAttribute("_rel");
  6601. if(D&&(D.toLowerCase()=="alternate")&&H&&(H.toLowerCase()=="application/rss+xml"||H.toLowerCase()=="application/atom+xml")){var V=J.getAttribute("_title");
  6602. var F=B.validateUrl(J.getAttribute("_href"))||false;
  6603. var T=(H.toLowerCase()=="application/rss+xml")?"rss":"atom";
  6604. if(V&&F){B.feeds.push({title:V,url:F,feedType:T})
  6605. }}}var C="";
  6606. switch(S){case"iframe":case"frame":case"script":case"img":case"embed":C=J.getAttribute("_src");
  6607. break;
  6608. case"link":var D=J.getAttribute("_rel");
  6609. D=D?D.toLowerCase():"";
  6610. if(D.indexOf("stylesheet")>-1){C=J.getAttribute("_href")
  6611. }else{if(D=="microsummary"){B.microsummaryUrl=B.validateUrl(J.getAttribute("_href"))||false
  6612. }}break;
  6613. default:break
  6614. }if(C){var L=B.validateUrl(C);
  6615. if(L){var E="";
  6616. if(S=="link"){E="stylesheets"
  6617. }else{if(S=="script"){E="scripts"
  6618. }else{if(S=="img"){E="images"
  6619. }else{if(S=="embed"){E="media"
  6620. }else{if(S=="frame"||S=="iframe"){E="documents"
  6621. }}}}}B.resources[E].push(L)
  6622. }}if(B.allowedTags[S]){var O={};
  6623. for(var R in B.allowedAttributes){if(B.allowedAttributes[R]["*"]||B.allowedAttributes[R][S]){var N=J.getAttribute("_"+R);
  6624. if(N){if(B.urlAttributes[R]){N=B.validateUrl(N,B.doc)
  6625. }if(N){if(S=="a"&&R=="href"){B.tags.links++;
  6626. B.links.push(N)
  6627. }O[R]=N
  6628. }}}}if(S=="img"){if(!O.width&&!O.height){var K=J.getAttribute("_style");
  6629. if(K&&(matches=K.match(/\bwidth\s*:\s*(\d+)(px)?/i))){O.width=matches[1]
  6630. }if(K&&(matches=K.match(/\bheight\s*:\s*(\d+)(px)?/i))){O.height=matches[1]
  6631. }}O._src=O.src;
  6632. O.src=B.pixel;
  6633. O._width=O.width||null;
  6634. O._height=O.height||null;
  6635. O.width=null;
  6636. O.height=null
  6637. }I="<"+S;
  6638. for(var R in O){if(O[R]!==null){I+=" "+R+'="'+B.encodeAttribute(O[R])+'"'
  6639. }}if(B.closedTags[S]){I+=" />";
  6640. return I
  6641. }else{I+=">"
  6642. }}else{I=" "
  6643. }var U="";
  6644. if(J.childNodes&&J.childNodes.length){for(var P=0;
  6645. P<J.childNodes.length;
  6646. P++){var G=J.childNodes[P];
  6647. if(G.nodeType==B.NODE_TYPE_TEXT){if(B.tagContainsText(S)){var M=B.extractText(G.data);
  6648. B.origText+=M;
  6649. if(B.cleanWhitespace&&(S!="pre")){M=M.replace(/(\n\r| )\s*[\n\r\f\v]\s*/g,"\n ");
  6650. M=M.replace(/\s*[\n\r\f\v]\s*/g,"\n ");
  6651. M=M.replace(/[ \t]+/g," ")
  6652. }U+=B.encodeAttribute(M)
  6653. }}else{if(G.tagName&&(G.nodeType==B.NODE_TYPE_ELEMENT)){U+=B.extractSafeHTML(G)
  6654. }}}if(B.testString&&(J.innerHTML.indexOf(B.testString)>-1)&&(U.indexOf(B.testString)==-1)){debug("lost test string HTMLParser.extractSafeHTML()",J);
  6655. B.testString=""
  6656. }}I+=U;
  6657. if(B.allowedTags[S]){I+="</"+S+">"
  6658. }return I
  6659. };
  6660. B.parse=function(G,F,H){var J=function(){};
  6661. if(Klib.Pref.get("Debug.profileHTMLParser")){var E=new Klib.Profiler("HTMLParser: "+F+": "+G.length+" bytes");
  6662. J=E.mark
  6663. }B.origHTML=G;
  6664. B.url=F;
  6665. B.doc=H;
  6666. B.initUrl(B.url,G);
  6667. B.origLength=G.length;
  6668. B.origText="";
  6669. B.cleanHTML="";
  6670. B.tagCount=0;
  6671. B.success=false;
  6672. B.tags={};
  6673. B.tags.links=0;
  6674. B.bodyfound=false;
  6675. B.initResourceStats();
  6676. B.isFrameset=false;
  6677. B.links=[];
  6678. B.startTime=Klib.timestamp(true);
  6679. B.timeout=B.startTime+Klib.Pref.get("Parser.maxTimeToParse",4);
  6680. B.regexProtocols=new RegExp("^("+B.allowedProtocols.replace(/\s*\,+\s*/g,"|")+"):","i");
  6681. if(B.testString&&(G.indexOf(B.testString)==-1)){debug('"'+B.testString+'" not found at origHTML');
  6682. B.testString=""
  6683. }G=G.replace(/<!--[\w\W]*?-->/gm,"");
  6684. J("removed comments");
  6685. if(B.testString&&(G.indexOf(B.testString)==-1)){debug('"'+B.testString+'" not found after removed comments');
  6686. B.testString=""
  6687. }G=G.replace(/<!--[\w\W]*?$/gm,"");
  6688. J("removed partial comments");
  6689. if(B.testString&&(G.indexOf(B.testString)==-1)){debug('"'+B.testString+'" not found after removed partial comments');
  6690. B.testString=""
  6691. }G=G.replace(/<\?[\w\W]*?\?>/gm,"");
  6692. J("removed instructions");
  6693. if(B.testString&&(G.indexOf(B.testString)==-1)){debug('"'+B.testString+'" not found after removed instructions');
  6694. B.testString=""
  6695. }G=G.replace(/<\?[\w\W]*?$/gm,"");
  6696. J("removed partial instructions");
  6697. if(B.testString&&(G.indexOf(B.testString)==-1)){debug('"'+B.testString+'" not found after removed partial instructions');
  6698. B.testString=""
  6699. }G=G.replace(/<[!%][^>]*>/gm,"");
  6700. G=G.replace(/<[!%][^>]*$/gm,"");
  6701. J("removed invalid tags");
  6702. if(B.testString&&(G.indexOf(B.testString)==-1)){debug('"'+B.testString+'" not found after removed invalid tags');
  6703. B.testString=""
  6704. }G=G.replace(/<((textarea|iframe|script|style|noscript|noembed|noframes|nolayer|nostyle)\b[^>]*)>([\w\W]*?)(<\/(\2)[^>]*>)/igm,"<$1 ></$2>");
  6705. J("remove tag contents");
  6706. if(B.testString&&(G.indexOf(B.testString)==-1)){debug('"'+B.testString+'" not found after remove tag contents');
  6707. B.testString=""
  6708. }G=G.replace(/<(textarea|iframe|script|style|noscript|noembed|noframes|nolayer|nostyle)\b[^>]*>[^<][\w\W]*$/igm,"");
  6709. J("remove partial contents");
  6710. if(B.testString&&(G.indexOf(B.testString)==-1)){debug('"'+B.testString+'" not found after remove partial contents');
  6711. B.testString=""
  6712. }var I=/<iframe[^>]*<script.*<\/iframe>/i;
  6713. if(I.test(G)){G=G.replace(/<iframe.*?<\/iframe\s*>/igm,"")
  6714. }G=G.replace(/(\s)\b([\w\-:][\w\-_:]*\s*=\s*)/gm," _$2");
  6715. J("disable ALL attributes");
  6716. if(B.testString&&(G.indexOf(B.testString)==-1)){debug('"'+B.testString+'" not found after disable ALL attributes');
  6717. B.testString=""
  6718. }B.isFrameset=(G.match(/<frameset\b/i)&&!G.match(/<body\b/i))?true:false;
  6719. B.disabledHTML=G;
  6720. B.renderUnsafePage(G);
  6721. J("renderUnsafePage");
  6722. var D=B.doc.getElementsByTagName("html")[0];
  6723. if(B.testString&&(D.innerHTML.indexOf(B.testString)==-1)){debug('"'+B.testString+'" not found after renderUnsafePage');
  6724. B.testString=""
  6725. }var C=B.doc.getElementsByTagName("*");
  6726. B.origTagCount=C.length;
  6727. J("get orig tag count");
  6728. B.cleanHTML=B.extractSafeHTML(D);
  6729. J("extractSafeHTML");
  6730. if(B.testString&&(B.cleanHTML.indexOf(B.testString)==-1)){debug('"'+B.testString+'" not found after extractSafeHTML');
  6731. B.testString=""
  6732. }if(B.tagCount>B.origTagCount){B.tagCount=B.origTagCount
  6733. }B.text=B.origText.replace(/(( (;?))|\s)+/ig," ");
  6734. B.parsedLength=B.cleanHTML.length;
  6735. B.parsedPercent=((B.tagCount/B.origTagCount)*100);
  6736. B.endTime=Klib.timestamp(true);
  6737. B.timeTaken=B.endTime-B.startTime;
  6738. B.success=true;
  6739. if(Klib.Pref.get("Debug.profileHTMLParser")){E.stop(true)
  6740. }return B.cleanHTML
  6741. };
  6742. B.encodeAttribute=function(D,C){D=D||"";
  6743. if(C){D=D.replace(/(&(;)?|&)/ig,"&")
  6744. }D=D.replace(/"/g,""");
  6745. D=D.replace(/'/g,"'");
  6746. D=D.replace(/</g,"<");
  6747. D=D.replace(/>/g,">");
  6748. return D
  6749. };
  6750. B.debugStats=function(D){var E="=== HtmlParser : "+B.url+" ===\n";
  6751. E+="\ncompleted :  "+B.tagCount+" of "+B.origTagCount+" tags ("+Klib.round(B.parsedPercent)+"%)";
  6752. E+="\ntime taken : "+Klib.round(B.timeTaken,3)+"s";
  6753. E+="\norig html size: "+Klib.byteSize(B.origLength,1);
  6754. E+="\ncleaned html size: "+Klib.byteSize(B.cleanHTML.length,1);
  6755. E+="\norig text size: "+Klib.byteSize(B.origText.length,1);
  6756. E+="\ncleaned text size: "+Klib.byteSize(B.text.length,1);
  6757. if(D){E+="\n === resources ===\n";
  6758. for(var C in B.resources){E+=C+" : "+B.resources[C].join("\n\t")+"\n"
  6759. }E+="\n === tags ===\n";
  6760. E+=B.tagCount+" of "+B.origTagCount+"\n";
  6761. for(var C in B.tags){E+=C+" : "+B.tags[C]+"\n"
  6762. }}return E
  6763. }
  6764. };
  6765. Klib.HTMLParser.clean=function(C,B,A){var D=new Klib.HTMLParser();
  6766. return D.parse(C,B,A)
  6767. };
  6768. if(Klib.install("HTMLDoc",0.1)){Klib.HTMLDoc.cache=new Klib.Cache.Obj("HTMLDoc",64);
  6769. Klib.HTMLDoc.STATE_INIT=0;
  6770. Klib.HTMLDoc.STATE_RETRIEVING_HEADERS=1;
  6771. Klib.HTMLDoc.STATE_RETRIEVING_BODY=2;
  6772. Klib.HTMLDoc.STATE_PARSING=3;
  6773. Klib.HTMLDoc.STATE_COMPLETE=4;
  6774. Klib.HTMLDoc.STATE_INCOMPLETE=5;
  6775. Klib.HTMLDoc.STATE_ERROR=99;
  6776. Klib.HTMLDoc.id=0;
  6777. Klib.HTMLDoc.get=function(B){var C=B.replace(/#.*$/,"");
  6778. var A=Klib.HTMLDoc.cache.get(C);
  6779. if(!A||A.stopped){A=new Klib.HTMLDoc.Obj(B)
  6780. }return A
  6781. };
  6782. Klib.HTMLDoc.Obj=function(A){var B=this;
  6783. Klib.HTMLDoc.id++;
  6784. B.id=Klib.HTMLDoc.id;
  6785. B.url=A;
  6786. B.parsedUrl=Klib.Url.parse(A);
  6787. B.title="";
  6788. B.urlPage=B.url.replace(/#.*$/,"");
  6789. B.state=Klib.HTMLDoc.STATE_INIT;
  6790. B.fetchHead=true;
  6791. B.fetchContent=true;
  6792. B.maxContentLength=Klib.Pref.getInt("Clue.maxContentLength",128)*1024;
  6793. B.bodyRetrieved=false;
  6794. B.fullyRetrieved=false;
  6795. B.parseHTML=true;
  6796. B.htmlParsed=false;
  6797. B.fullyParsed=false;
  6798. B.contentLength=0;
  6799. B.stopped=false;
  6800. B.cacheOnError=true;
  6801. B.requestHeaders={};
  6802. B.forcingRefresh=false;
  6803. B.isFrameset=false;
  6804. B.stats={};
  6805. B.meta={};
  6806. B.feeds=[];
  6807. B.handleHeadReceived=function(C){if(B.stopped){return false
  6808. }if(B.fetchContent&&C.headers&&C.headers.content_type&&(C.headers.content_type.match(/text/i)||Klib.isHTMLHeader(C.headers)||Klib.Feed.isFeedContentType(C.headers.content_type))){B.setState(Klib.HTMLDoc.STATE_RETRIEVING_BODY);
  6809. return true
  6810. }else{return false
  6811. }};
  6812. B.handleAjaxComplete=function(C){if(B.stopped){return 
  6813. }if(B.state==Klib.HTMLDoc.STATE_RETRIEVING_BODY){B.bodyRetrieved=true;
  6814. if(C.status==200||C.status==206){B.fullyRetrieved=true
  6815. }else{}}B.endTime=Klib.timestamp(true);
  6816. B.retrievalTime=(B.endTime-B.startTime);
  6817. B.headers=C.headers;
  6818. B.responseHeader=C.responseHeader;
  6819. B.responseURI=C.responseURI||"";
  6820. B.status=C.status;
  6821. B.statusText=C.statusText;
  6822. B.contentType=(C.headers.content_type)?C.headers.content_type.replace(/;.*$/,"").toLowerCase():"";
  6823. B.contentLength=C.contentLength;
  6824. B.isHtml=Klib.isHTMLHeader(B.contentType);
  6825. B.isText=B.contentType.indexOf("text")&&!B.isHtml;
  6826. B.responseText=C.responseText;
  6827. B.responseXML=C.responseXML;
  6828. B.origHTML=C.responseText;
  6829. B.cleanHTML="";
  6830. B.charset=C.charset;
  6831. B.debug("retrieved",(B.responseText.length+" bytes"),B.retrievalTime+" sec",C.headers);
  6832. B.error=(C.error&&(C.status!=Klib.Ajax.STATUS_MAX_LENGTH_EXCEEDED));
  6833. if(B.error){B.error=true;
  6834. B.setState(Klib.HTMLDoc.STATE_ERROR);
  6835. if(!B.cacheOnError){Klib.HTMLDoc.cache.remove(B.url);
  6836. Klib.HTMLDoc.cache.remove(B.urlPage);
  6837. Klib.LinkScent.clueIconCache.remove(B.url)
  6838. }}else{if(B.isHtml){B.extractTitle();
  6839. if(B.parseHTML&&B.bodyRetrieved){B.doParseHTML();
  6840. B.setState(Klib.HTMLDoc.STATE_COMPLETE)
  6841. }else{B.setState(Klib.HTMLDoc.STATE_INCOMPLETE)
  6842. }}else{B.setState(Klib.HTMLDoc.STATE_COMPLETE)
  6843. }}if(B.microsummaryUrl){B.fetchMicrosummary()
  6844. }B.fireEvent("complete")
  6845. };
  6846. B.extractTitle=function(){if(B.isHtml&&B.origHTML&&B.origHTML.match){var C=B.origHTML.match(/<title[^>]*>([^<]*)</i);
  6847. if(C){B.title=Klib.Html.stripTags(C[1])
  6848. }else{C=B.origHTML.match(/<h(1|2)[^>]*>([^<]*)<\/h(1|2)>/i);
  6849. if(C){B.title=Klib.Html.stripTags(C[2])
  6850. }}}};
  6851. B.fireEvent=function(I,E,C){C=C||B;
  6852. B.debug(I+((E)?":external":""));
  6853. var D=B.events[I]||[];
  6854. if(E){D=E[I]||[]
  6855. }for(var F=0;
  6856. F<D.length;
  6857. F++){var G=D[F];
  6858. if(G){B.events[I][F]=null;
  6859. try{G(C)
  6860. }catch(H){Klib.error("Unable to call htmldoc event handler",G.toString(),H)
  6861. }}}};
  6862. B.events={};
  6863. B.addEvent=function(E,D,C){B.events[E]=B.events[E]||[];
  6864. if(C){B.events[E].push(function(F){D(F,C)
  6865. })
  6866. }else{B.events[E].push(D)
  6867. }};
  6868. B.addEvents=function(D){for(var F in D){for(var E=0;
  6869. E<D[F].length;
  6870. E++){var C=D[F][E];
  6871. B.addEvent(F,C)
  6872. }}};
  6873. B.receiveMicrosummary=function(C){B.microsummaryFetching=false;
  6874. B.microsummaryFetched=true;
  6875. B.microsummaryText="";
  6876. if(!C.error){var D=C.responseText;
  6877. if(D&&D.match(/<generator/i)){}else{if(D){B.microsummaryText=Klib.Html.stripTags(Klib.Html.clean(D))
  6878. }else{}}}else{Klib.warning("Failed to retrieve microsummary for "+C.url,C.error)
  6879. }B.fireEvent("receiveMicrosummary")
  6880. };
  6881. B.fetchMicrosummary=function(){if(!B.microsummaryFetching){B.microsummaryFetching=true;
  6882. Klib.Ajax.get(B.microsummaryUrl,B.receiveMicrosummary);
  6883. B.fireEvent("fetchingMicrosummary")
  6884. }};
  6885. B.doParseHTML=function(){if(B.stopped){return 
  6886. }B.setState(Klib.HTMLDoc.STATE_PARSING);
  6887. B.microsummaryUrl=false;
  6888. B.microsummaryText="";
  6889. var C=Klib.timestamp(true);
  6890. var E=new Klib.HTMLParser();
  6891. var D=(B.responseURI)?B.responseURI:B.url;
  6892. E.parse(B.origHTML,D,Klib.ClueBridge.parserFrameTemp.doc);
  6893. B.origText=E.origText;
  6894. B.text=E.text;
  6895. B.cleanHTML=E.cleanHTML;
  6896. B.stats.tags=E.tags;
  6897. B.stats.resources=E.resources;
  6898. B.stats.parsingTime=E.timeTaken;
  6899. B.links=E.links;
  6900. B.origLength=E.origLength;
  6901. B.parsedLength=E.parsedLength;
  6902. B.remainingHtml=E.remainingHtml;
  6903. B.parsedPercent=E.parsedPercent;
  6904. B.isFrameset=E.isFrameset;
  6905. B.disabledHTML=E.disabledHTML;
  6906. B.feeds=E.feeds;
  6907. B.meta=E.meta;
  6908. if(B.fullyRetrieved&&E.success){B.fullyParsed=true
  6909. }else{}B.htmlParsed=true;
  6910. B.debug("parsed",E.debugStats());
  6911. B.microsummaryUrl=E.microsummaryUrl
  6912. };
  6913. B.debug=function(){var C="HTMLDoc:"+B.id;
  6914. C+=(arguments)?(":"+Klib.toDebugString(arguments)):"";
  6915. C+=":"+B.url
  6916. };
  6917. B.halt=function(){B.stopped=true;
  6918. B.state=Klib.HTMLDoc.STATE_ERROR;
  6919. Klib.HTMLDoc.cache.remove(B.url);
  6920. Klib.HTMLDoc.cache.remove(B.urlPage)
  6921. };
  6922. B.fetch=function(E){B.stopped=false;
  6923. B.isFrameset=false;
  6924. B.urlPage=B.url.replace(/#.*$/,"");
  6925. B.parsedUrl=Klib.Url.parse(B.url);
  6926. B.forcingRefresh=B.forcingRefresh||E;
  6927. B.debug("fetch","forceRefresh = "+(B.forcingRefresh?"yes":"no"));
  6928. var D=Klib.HTMLDoc.cache.get(B.urlPage);
  6929. var C=(D&&!B.forcingRefresh);
  6930. if(C){if(D.stopped){C=false
  6931. }else{if(D.state==Klib.HTMLDoc.STATE_COMPLETE){C=true
  6932. }else{if(D.state==Klib.HTMLDoc.STATE_ERROR&&(D.status==Klib.Ajax.STATUS_ABORTED||D.status==403)){C=false
  6933. }else{if(B.fetchHead&&!D.fetchHead){C=false
  6934. }if(B.fetchContent&&(!D.fetchContent||!D.bodyRetrieved)){C=false
  6935. }if(B.parseHTML&&D.isHtml&&!D.htmlParsed){if(D.bodyRetrieved){D.parseHTML=true;
  6936. B.debug("parsing html from cached doc ",D.id);
  6937. D.doParseHTML();
  6938. D.setState(Klib.HTMLDoc.STATE_COMPLETE)
  6939. }else{D.parseHTML=true
  6940. }}}}}}if(C){switch(D.state){case Klib.HTMLDoc.STATE_ERROR:case Klib.HTMLDoc.STATE_COMPLETE:B.debug("cached : completed");
  6941. D.fireEvent("complete",B.events,D);
  6942. break;
  6943. case Klib.HTMLDoc.STATE_INCOMPLETE:B.debug("cached : incomplete");
  6944. if(D.bodyRetrieved){D.doParseHTML();
  6945. D.setState(Klib.HTMLDoc.STATE_COMPLETE);
  6946. D.fireEvent("complete",B.events,D)
  6947. }else{D.addEvents(B.events);
  6948. D.fetchContent=true;
  6949. D.parseHTML=true;
  6950. D.fetch()
  6951. }break;
  6952. default:B.debug("cached : waiting");
  6953. D.addEvents(B.events);
  6954. break
  6955. }}else{if(D&&D.state!=Klib.HTMLDoc.STATE_COMPLETE){B.debug("Halting previous htmldoc request",D.id,D.url);
  6956. D.halt();
  6957. B.events=D.events
  6958. }Klib.HTMLDoc.cache.add(B.urlPage,B);
  6959. B.setState(Klib.HTMLDoc.STATE_RETRIEVING_HEADERS);
  6960. B.bodyRetrieved=false;
  6961. B.fullyRetrieved=false;
  6962. B.htmlParsed=false;
  6963. B.fullyParsed=false;
  6964. B.contentLength=0;
  6965. B.startTime=Klib.timestamp(true);
  6966. B.debug("fetching",B.urlPage);
  6967. B.ajax=new Klib.Ajax.Obj(B.urlPage);
  6968. B.ajax.requestType="htmldoc";
  6969. B.ajax.onHead=B.handleHeadReceived;
  6970. B.ajax.onComplete=B.handleAjaxComplete;
  6971. B.ajax.maxContentLength=B.maxContentLength;
  6972. B.ajax.timeout=Klib.Pref.get("ClueScript.defaultTimeout",10);
  6973. B.ajax.checkEncoding=true;
  6974. B.ajax.requestHeaders=B.requestHeaders;
  6975. B.ajax.send()
  6976. }};
  6977. B.throwError=function(){};
  6978. B.setState=function(C){B.state=C
  6979. }
  6980. }
  6981. }if(Klib.install("Locale",0.1)){Klib.getString=function(F){var A=Klib.getString.bundle||top.document.getElementById("interclue-stringbundle");
  6982. Klib.getString.bundle=A;
  6983. var E=null;
  6984. if(arguments.length==1){try{E=A.getString(F)
  6985. }catch(D){}}else{var C=[];
  6986. for(var B=1;
  6987. B<arguments.length;
  6988. B++){C.push(arguments[B])
  6989. }try{E=A.getFormattedString(F,C)
  6990. }catch(D){}}if(E===null){Klib.warning("Cannot find translation for ["+F+"]");
  6991. E=""
  6992. }return E
  6993. };
  6994. Klib.string=function(F){var A=Klib.getString.bundle||top.document.getElementById("interclue-stringbundle");
  6995. Klib.getString.bundle=A;
  6996. var E=null;
  6997. if(arguments.length==1){try{E=A.getString(F)
  6998. }catch(D){}}else{var C=[];
  6999. for(var B=1;
  7000. B<arguments.length;
  7001. B++){C.push(arguments[B])
  7002. }try{E=A.getFormattedString(F,C)
  7003. }catch(D){}}if(E===null){Klib.error("Cannot find translation for ["+F+"]");
  7004. E=""
  7005. }return E
  7006. };
  7007. Klib.Strings={};
  7008. Klib.Strings.overwrite={};
  7009. Klib.Locale.dictionary={};
  7010. Klib.Locale.plurals={};
  7011. var _=function(B,A){A=A||{};
  7012. if(Klib.Locale.dictionary[B]||Klib.Locale.dictionary[B]===""){B=Klib.Locale.dictionary[B]
  7013. }else{Klib.warning("translation string is missing for ",B);
  7014. return""
  7015. }return Klib.Locale.substitute(B,A,Klib.Locale.plurals)
  7016. };
  7017. Klib.getString=_;
  7018. Klib.translate=function(A){if(typeof A=="string"){return Klib.Locale.substitute(A,Klib.Locale.dictionary)
  7019. }else{if(A.nodeType&&A.nodeType==Klib.NODE_TYPE_DOCUMENT){Klib.Locale.initDoc(A);
  7020. return true
  7021. }else{if(A.nodeType&&(A.nodeType==Klib.NODE_TYPE_ELEMENT||A.nodeType==Klib.NODE_TYPE_DOCUMENT_FRAGMENT)){Klib.Locale.substituteTextNodes(A);
  7022. return true
  7023. }else{Klib.error("Invalid object passed to translate()",A);
  7024. return A
  7025. }}}};
  7026. Klib.Locale.loadLanguage=function(A){Klib.Locale.dictionary={};
  7027. Klib.Locale.loadDictionary(Klib.Strings.en);
  7028. if(A!="en"){Klib.Locale.loadDictionary(Klib.Strings[A])
  7029. }Klib.Locale.dictionary["app.name"]=Klib.App.name;
  7030. Klib.Locale.dictionary["app.subname"]=Klib.App.subName;
  7031. Klib.Locale.dictionary["app.fullname"]=Klib.App.subName?(Klib.App.name+"-"+Klib.App.subName):Klib.App.name;
  7032. Klib.Locale.dictionary["app.version"]=Klib.App.version;
  7033. Klib.Locale.dictionary["app.build"]=Klib.App.build;
  7034. Klib.Locale.dictionary["app.platform"]=Klib.platform;
  7035. Klib.Locale.dictionary.skinUrl=Klib.skinUrl();
  7036. Klib.Locale.loadDictionary(Klib.Strings.overwrite)
  7037. };
  7038. Klib.regexMatch=function(D,B,A){A=A||0;
  7039. var C=D.match(B);
  7040. return(C)?C[A]:""
  7041. };
  7042. Klib.Locale.substitute=function(str,subs,plurals){if(typeof str!="string"){if(str.toString){str=str.toString()
  7043. }else{Klib.error("invalid object passed to Klib.Locale.substitute()",str);
  7044. return str
  7045. }}var replacements=str.match(/\{[\w\.]+(\,[^\}\n]*)?\}/g);
  7046. if(replacements){for(var i=0;
  7047. i<replacements.length;
  7048. i++){var needle=replacements[i];
  7049. var args=needle.substr(1,needle.length-2).split(/\s*\,\s*/g);
  7050. var key=args.shift();
  7051. var sub="";
  7052. var format=(args.length&&args[0].match(/^\w+$/))?args[0]:"string";
  7053. switch(format){case"integer":case"int":case"i":if(subs[key]!==undefined){sub=parseInt(subs[key])
  7054. }else{if(Klib.platform!="IEToolbar"){Klib.warning("Missing substitution variable in Klib.Locale.substitute",key,str)
  7055. }}break;
  7056. case"string":case"s":case"":if(subs[key]!==undefined){sub=subs[key]
  7057. }else{if(Klib.Locale.dictionary[key]){sub=Klib.Locale.dictionary[key]
  7058. }else{sub="";
  7059. try{eval("sub = "+key)
  7060. }catch(e){if(Klib.platform!="IEToolbar"){Klib.warning("Missing substitution variable in Klib.Locale.substitute",key,str)
  7061. }}}}break;
  7062. case"plural":case"p":if(args.length!=1){Klib.warning("Invalid args for pluralisation",key,str,subs,plurals)
  7063. }else{if(!plurals[key]){Klib.warning("Missing pluralalisation variable in Klib.Locale.substitute",key,str,plurals)
  7064. }else{if(subs[args[0]]===undefined){Klib.warning("Cannot find pluralalisation number Klib.Locale.substitute",key,args[0],str,plurals)
  7065. }else{if(parseInt(subs[args[0]])==1){sub=plurals[key][0]
  7066. }else{sub=plurals[key][1]
  7067. }}}}break;
  7068. case"sprite":if(Klib.sprites[key]){sub=Klib.sprites[key].getHTML()
  7069. }else{Klib.error("Unable to find sprite for translation string",key,str)
  7070. }break;
  7071. default:Klib.warning("Invalid format in Klib.Locale.substitute",format,str,subs);
  7072. break
  7073. }sub=Klib.Locale.substitute(sub,subs,plurals);
  7074. str=str.replace(needle,sub)
  7075. }}return str
  7076. };
  7077. Klib.Locale.loadPlurals=function(B){for(var A in B){Klib.Locale.plurals[A]=B[A]
  7078. }};
  7079. Klib.Locale.loadDictionary=function(B){for(var A in B){Klib.Locale.dictionary[A]=B[A]
  7080. }};
  7081. Klib.Locale.initDoc=function(B){var A=Klib.getWin(B);
  7082. B.title=Klib.translate(B.title);
  7083. if(A.setTitle){A.setTitle(B.title)
  7084. }if(B.body){Klib.translate(B.body)
  7085. }else{Klib.error("Doc has no body Klib.Locale.initDoc()",B)
  7086. }};
  7087. Klib.getAttr=function(B,A){if(!B){Klib.error("Invalid object",B);
  7088. return""
  7089. }else{if(B[A]!==undefined){return B[A]
  7090. }else{if(B.getAttribute){var C=B.getAttribute(A);
  7091. return(C===null)?"":C
  7092. }}}return""
  7093. };
  7094. Klib.setAttr=function(D,A,C){if(!D){Klib.error("Invalid object",D)
  7095. }if(D.isArray){for(var B=0;
  7096. B<D.length;
  7097. B++){Klib.setAttr(D[B],A,C)
  7098. }}else{if(D.setAttribute){D.setAttribute(A,C)
  7099. }else{D[A]=C
  7100. }}};
  7101. Klib.replaceNode=function(D,F){var E=D.ownerDocument;
  7102. E.parserDiv=E.parserDiv||E.createElement("div");
  7103. E.parserDiv.innerHTML=F;
  7104. var A=D;
  7105. for(var C=E.parserDiv.childNodes.length-1;
  7106. C>=0;
  7107. C--){var B=E.parserDiv.childNodes[C];
  7108. A.parentNode.insertBefore(B,A);
  7109. A=B
  7110. }D.parentNode.removeChild(D)
  7111. };
  7112. Klib.Locale.editTextNodes=function(B){if(B.shiftKey&&B.ctrlKey){B.halt();
  7113. var E=B.source;
  7114. var D=E.innerHTML;
  7115. var A="";
  7116. if(E.translatedStrings){for(var C=0;
  7117. C<E.translatedStrings.length;
  7118. C++){if(E.translatedStrings[C].translated==D){A=E.translatedStrings[C].orig;
  7119. break
  7120. }else{A+=E.translatedStrings[C].orig+"\n--\n"
  7121. }}}Klib.BugReporter.openWin(function(G){var F=G.document;
  7122. $("Translation-string-id",F).value=Klib.trim(A);
  7123. $("Translation-old-text",F).value=Klib.trim(D);
  7124. $("Translation-new-text",F).value=Klib.trim(D);
  7125. $("problem-Translation",F).click();
  7126. $("tab-box",F).selectTab("translation-tab");
  7127. $("Translation-new-text",F).focus()
  7128. })
  7129. }};
  7130. Klib.Locale.substituteTextNodes=function(M){var I=Klib.Pref.get("Debug.showWarningsForMissingTranslations");
  7131. var E=[];
  7132. var A=Klib.Pref.get("BugReporter.showTranslationPanel");
  7133. if(A){Klib.addEvent(M,"click",Klib.Locale.editTextNodes)
  7134. }if(M.childNodes){for(var F=0;
  7135. F<M.childNodes.length;
  7136. F++){var D=M.childNodes[F];
  7137. if(D.nodeType==Klib.NODE_TYPE_ELEMENT){Klib.Locale.substituteTextNodes(D)
  7138. }else{if(D.nodeType==Klib.NODE_TYPE_TEXT){var C=Klib.translate(D.data);
  7139. if(D.data!=C){M.translatedStrings=M.translatedStrings||[];
  7140. M.translatedStrings.push({orig:D.data,translated:C});
  7141. Klib.replaceNode(D,C)
  7142. }else{if(I&&Klib.trim(D.data)){E.push(Klib.trim(D.data))
  7143. }}}}}}var L=["title","alt","url"];
  7144. for(var F=0;
  7145. F<L.length;
  7146. F++){var J=L[F];
  7147. var G=Klib.getAttr(M,J);
  7148. if(G){var B=Klib.translate(G);
  7149. if(B!=G){Klib.setAttr(M,J,B)
  7150. }}}if(M.tagName&&M.tagName.toLowerCase()=="input"&&Klib.getAttr(M,"type").match(/(submit|button)/i)){var K=Klib.getAttr(M,"value");
  7151. var B=Klib.translate(K);
  7152. if(K!=B){Klib.setAttr(M,"value",B)
  7153. }}if(I&&(E.length>0)&&M.ownerDocument){var H=(M&&M.ownerDocument)?M.ownerDocument.URL:M;
  7154. Klib.warning("Translate: untranslated text nodes",H,E)
  7155. }};
  7156. Klib.Locale.onPrefChanged=function(A){if(A.key=="User.language"){Klib.Locale.loadLanguage(A.value)
  7157. }}
  7158. }Klib.Strings.en={"app.id":"interclue","app.name":"Interclue","app.domain":"interclue.com",cancel:"Cancel",close:"Close",clue:"clue",clues:"clues",cluecursor:"Linkclue Cursor",cluecursors:"Linkclue Cursors",clueview:"Clueview",clueframe:"Clueviewer",clueframes:"Clueviewers",cluescript:"Cluescript","delete":"Delete",donate:"Donate",error:"Error",favicon:"FavIcon",favicons:"FavIcons",hide:"Hide",hotkey:"HotKey",linkscent:"Linkclue",linkscents:"Linkclues",login:"Login",metadata:"Metaclues",more:"more",ok:"Ok",save:"Save",send:"Send",show:"Show",smartscent:"Smartclue",smartscents:"Navigation",smartscentslogic:"Navigation detection rules",unknown:"unknown","url.website":"http://interclue.com/#from:{app.platform}","url.website.clean":"http://interclue.com/","url.blog":"http://blog.interclue.com/#from:{app.platform}","url.donate":"http://interclue.com/donate.html#from:{app.platform}","url.docs":"http://interclue.com/documentation.html#from:{app.platform}","url.bugreporter":"https://interclue.com/pluginapi/feedback.php","url.update":"https://interclue.com/xpi/versions.php","url.beta.update":"https://interclue.com/xpi/beta/version.json","url.about":"http://interclue.com/team.html#from:{app.platform}","url.credits":"http://interclue.com/credits.html#from:{app.platform}","url.download.firefox":"http://interclue.com/get-interclue.html#from:{app.platform}","url.interclue.premium":"http://interclue.com/premium.html#from:{app.platform}","url.spread.the.word":"http://interclue.com/spread-the-word.html#from:{app.platform}","url.faq":"http://interclue.com/faq.html#from:{app.platform}","url.oninstall":"http://interclue.com/1.5.6-install.html#from:{app.platform}","url.onupdate":"http://interclue.com/1.5.6-update.html#from:{app.platform}","url.tutorial.link1":"http://interclue.com/#from:{app.platform}","url.tutorial.pdf":"http://media.interclue.com/main/Interclue.pdf","url.tutorial.link3":"http://interclue.com/buzz.html#from:{app.platform}","url.tutorial.link4":"http://blog.interclue.com/#from:{app.platform}","url.tutorial.link5":"http://sethop.com/","url.credit.seth":"http://sethop.com/","url.mozilla.comment":"https://addons.mozilla.org/en-US/firefox/reviews/display/4999","url.mozilla.register":"https://addons.mozilla.org/en-US/firefox/users/register","url.mozilla.thread":"http://forums.mozillazine.org/viewtopic.php?t=558742","url.google.group":"http://groups.google.com/group/interclue-user","url.user.login":"https://interclue.com/pluginapi/login.php","url.summaryserver.reportbadsummary":"https://interclue.com/pluginapi/reportBadSummary.php","url.bookmark":"https://interclue.com/ClueServer/userLink.php?action:save","url.summaryserver.precache":"https://interclue.com/SummaryServer/summariser/precache.php","url.user.pref.save":"https://interclue.com/ClueServer/userPrefSave.php","about.version":"version: {app.version} [checkin {app.build}]","about.link.privacy":"Privacy policy","about.link.terms":"Terms and Conditions","about.credits.extended":'<ul>    <li><a href="http://www.quirksmode.org/">Peter-Paul Koch</a> (heaps of stuff)</li>    <li><a href="http://www.crockford.com/">Douglas Crockford</a> (JSON library)</li>    <li><a href="http://dotnetjunkies.com/WebLog/jking/archive/2003/07/21/488.aspx">Joe King</a> (iframe shim for IE)</li>    <li><a href="http://pajhome.org.uk/crypt/md5">PAJ</a> (MD5 encryption)</li></ul>',"about.description":'    <address>        Interclue Ltd,<br />        200 Armagh St,<br />        Christchurch,<br />        New Zealand<br />        <a href="{url.website}">{app.domain}</a><br />    </address>    <h4>{app.name} was developed by <a href="{url.website}">Interclue Ltd</a>.</h4>    <ul>        <li>Founder: <a href="{url.credit.seth}">Seth Wagoner</a></li>        <li>Lead Developer: Karl Dearden</li>        <li>Lead Sysadmin: Nic Scott</li>    </ul>    <p>        With help from <a href="{url.credits}">all these people</a>.    </p>    <p>        Read more about {app.name} on our <a href="{url.about}">about page</a> or the <a href="{url.blog}" >blog</a>.    </p>',"ajax.error.cannot.find.server":"Failed to locate the server.","ajax.error.unknown":"Unknown error","ajax.error.maximum.length.exceeded":"Maximum length exceeded","ajax.error.permission.denied":"Permission denied.","ajax.error.aborted":"Request halted","ajax.error.request.timed.out":"Request timed out.","ajax.error.json.decoding.error":"Invalid JSON string","ajax.error.redirect.circular":"Url redirects back to itself","ajax.error.redirect.limit":"Redirect limit reached","ajax.error.invalid.url":"Invalid Url","ajaxform.collecting.form.data":"Collecting form data...","ajaxform.connecting.to.server":"Connecting to server...","ajaxform.processing.request":"Processing request...","ajaxform.server.error":"Sorry, the server is down for maintenance at the moment.","ajaxform.form.error":"There was an error in the form.","ajaxform.success":"Done!","ajaxsummariser.summary.failed":"<p>Sorry, we could not create an accurate summary of this URL for you.</p>","ajaxsummariser.qfs.enable":'<div><h3>Quality Feedback System</h3><p>It would be very helpful if you turned on the automatic quality feedback system, which alerts our server that there\'s     been a problem summarizing a particular URL.</p>    <input id="interclue-qfs-enable" class="interclue-button" type="button" value="{ajaxsummariser.button.enable.qfs}" />    <p><em>Note that we do not store any user identity information with the URL, so your privacy is protected.</em></p></div>',"ajaxsummariser.button.enable.qfs":"Enable quality feedback system","ajaxsummariser.button.disable.qfs":"Disable quality feedback system","alert.default.title":" ","bugreporter.error.no.catagory":"Please select a catagory for your report","bugreporter.error.invalid.email":"Invalid Email Address: if you would like us to get back to you about this then we'll need a valid email address","bugreporter.button.view.report":"View Report","bugreporter.button.view.report.cancel":"Go Back","bugreporter.problems.common.title":"Common Problems","bugreporter.title":"Bugs and Feedback related to the Interclue Firefox Add-on","bugreporter.title.info":"WebPage Info","bugreporter.report.title":"Report","bugreporter.problem.title":"What's the problem?","bugreporter.recreate.title":"How can we recreate it?","bugreporter.recreate.description":"What steps will our programmers need to take to re-create the problem. This is probably the most important part of the report.","bugreporter.comments.title":"Comments","bugreporter.comments.description":"Anything else you think might help us to solve the problem. (eg. I also have google toolbar installed.)","bugreporter.debuglog.title":"Include debug info?","bugreporter.debuglog.description":"Please note: this may sent information about the last few urls you have visited.","bugreporter.debuglog.view":"click here to view the extended debug info that will be sent.","bugreporter.userinfo.title":"User Info","bugreporter.contact.title":"Allow Contact","bugreporter.contact.description":"It's ok to contact me regarding this issue.","bugreporter.email.title":"Email Address","bugreporter.link.location":"Current Location","bugreporter.link.destination":"Link Destination","bugreporter.invalid.server.response":"Sorry, the server sent an invalid response. The report was <em>NOT</em> received.","bugreporter.problems.smartscents.instead.of.linkscents":"Is a {cluecursor} appearing when it should be a {linkscent} Icon?","bugreporter.report.received":"Thanks for your report","bugreporter.server.connecting":"Connecting to server...","bugreporter.server.processing":"Processing report...",changelog:"ChangeLog","changelog.title":"{app.name} ChangeLog","clipboard.success.title":"Clipboard","clipboard.error.title":"Clipboard Error","clipboard.copy.failed":"Sorry, an error occured whilst attempting to copy the data to the clipboard. The data has <em>not</em> been copied.","clipboard.copy.succeeded":"Copied to clipboard","clue.error.generic":"<h1>{status} : {statusText}</h1><div>Sorry, we were unable to retrieve any content from {url}</div>","clue.error.request.timed.out":'<h1>Request timed out</h1>    <p>Sorry, the page <a href="{url}">{url}</a> took longer than {timeout} seconds to download.    so we cannot provide a summary for you.</p>    <p> If you want to wait longer than {timeout} seconds for pages to download in future,     then <a href="javascript:;" prefpage="clueviewer">open the options dialog</a> and change the "Miscellaneous|Default Timeout" setting.',"clue.imagepreview.fullsize.link.text":"view full size","clue.imagepreview.click.to.show.fullsized.image":"Click to show full sized image","clue.imagepreview.image.error":"Sorry, unable to load image","clue.imagepreview.image.loading":"loading...","clue.imagepreview.image.size.unknown":"Sorry, unable to retrieve file size","clue.imagepreview.image.too.large":'<h3>Image too large</h3><p>Your maximum auto preview image size is set to {maxImageSize}kB.</p><p><a id="imagepreview-forcepreview" href="javascript:;">Click here to view this image anyway.</a></p>',"clue.reloading":"reloading...","clue.unsafeurl.title":"This may be an action-taking link","clue.unsafeurl.wordlist.before":"This URL contains the following word(s)","clue.unsafeurl.wordlist.after":"Which may mean that previewing the link might cause an action to occur, so we will only fetch it for you if you confirm that it's ok to preview.","clue.unsafeurl.safeurl":"It's safe, preview it","clue.unsafeurl.safedomain":"All links on this site are safe","clueframe.showevent.hover.titlehint":"Click on the {linkscent} icon to show the {clueframe}","clueframe.status.loading":"loading...","clueframe.status.retrieving":"fetching...","clueframe.status.parsing":"...","clueframe.status.error":"Error!","clueframe.status.done":"Done.","clueframe.status.default":"","clueframe.loading":"","clueframe.alert.click.to.close":"[Click to close]","clueframe.button.nextLink":"Show the clue for the next link","clueframe.button.nextSimilarLink":"Show the clue for the next similar link","clueframe.button.prevLink":"Show the clue for the previous link","clueframe.button.prevSimilarLink":"Show the clue for the previous similar link","clueframe.button.windowsLive":"Add link to Windows Live favourites","clueframe.button.stumbleUpon":"Stumble this","clueframe.button.reddit":"Reddit this","clueframe.button.facebook":"Facebook: share this url","clueframe.button.history":"View the previous Clue","clueframe.button.historyNext":"View the next Clue","clueframe.button.historyPrevDisabled":"View the previous Clue","clueframe.button.historyNextDisabled":"View the next Clue","clueframe.button.bookmark":"Bookmark this link","clueframe.button.close":"Close the {clueframe}","clueframe.button.followcurrentlinknewtab":"Open this page in a new background tab","clueframe.button.followcurrentlinknewtabfocus":"Open this page in a new tab","clueframe.button.followcurrentlink":"Open this page in the current window","clueframe.button.selectTabForLink":"Select the tab where this page is already open","clueframe.button.sendto":"Email {clue} content, or selected text from {clue}","clueframe.button.sendto.textCopiedToClipboard":"-- Body text too long to automatically send to email client --\n-- Text copied to clipboard, hit [CTRL + A] to select all   --\n-- and [CTRL + V] to paste text into message                --\n\n\n","clueframe.button.google.bookmark":"Google bookmark this link","clueframe.button.newsvine.seed":"Newsvine: Seed this link","clueframe.button.refresh":"Refresh the current {clue}","clueframe.button.fontsizeincrease":"Increase Font Size","clueframe.button.fontsizedecrease":"Decrease Font Size","clueframe.button.options":"Change your options","clueframe.button.print":"Print the {clueframe}","clueframe.button.bugreport":"Send Interclue Related Feedback or Bug Reports","clueframe.button.badsummaryreport":"Report a bad summary","clueframe.button.delicious":"Add to Del.icio.us","clueframe.button.digg":"Digg this","clueframe.button.donate":"Help us make you more productive","clueframe.button.visitforums":"Fill in a mini-survey","clueframe.button.yahooMyWeb":"Add to Yahoo My Web","clueframe.buttongroup.history":"History of Clues seen on this page","clueframe.buttongroup.summaryImages":"Toggle images on and off in summaries","clueframe.buttongroup.linkNavigation":"Navigate back and forward between links on a page","clueframe.buttongroup.linkNavigationSimilar":"Navigate back and forward between similar links only","clueframe.button.turboNote":"Send selected text to TurboNote","clueframe.button.turboNote.copyToClipboard":"\t== Text too long! ==\nTurboNote can only handle up to 255 characters via it's command line interface.\nYour text has been copied to the Clipboard so you can paste it into the new note.","clueframe.button.turboNote.newNoteCreated":"New note created.","clueframe.button.turboNote.textCopiedToClipboard":"-- text too long to automatically send to TurboNote     --\n-- Text copied to clipboard, hit [CTRL + A] (select all) --\n-- and [CTRL + V] to paste the text into this note       --\n\n","clueframe.button.quicknote":"Send Clue to QuickNote","clueframe.button.summaryimagesdisable":"Disable Images In Summaries","clueframe.button.summaryimagesenable":"Enable Images in Summaries","clueframe.button.copytoclipboard":"Copy to Clipboard","clueframe.button.copylinkurltoclipboard":"Copy link URL to Clipboard","clueframe.buttontable.buttons":"{clueframe} Buttons","clueframe.buttontable.title.toolbar":"Enabled","clueframe.buttontable.title.legend":"Legend","clueframe.buttontable.title.action":"Statusbar Button","clueframe.buttontable.title.statusbar":"Statusbar","clueframe.buttontable.title.statusbar.menu":"Menu","clueframe.buttontable.title.statusbar.none":"None","clueframe.error.document.doesnt.allow.clues":"Sorry, this document doesn't allow the {clueframe} to be shown","clueframe.error.no.help.for.clue":"Sorry, we cannot find any help for this {cluescript}","clueframe.error.cannot.find.referrer":"Sorry, we cannot find any referrer information from this page","custombuttons.buttontable.buttonname":"Button Name","custombuttons.buttontable.actions":"Actions","custombuttons.buttontable.enabled":"Enabled","custombuttons.buttontable.invalid":"invalid","custombuttons.buttontable.edit":"edit","custombuttons.buttontable.delete":"delete","custombuttons.question.delete":'Are you sure you want to permanently delete button "{btnId}"?',"date.months":"January, February, March, April, May, June, July, August, September, October, November, December","email.disclaimer":"This message was created using the new free browser addon from {url.website.clean}","email.link.destination.url":"URL","email.link.location.url":"Linked From","form.required.field":"Required field","hint.clueframelocked":"<p>You have entered Pinned Mode.</p>    <p>In this mode the {clueframe} will stay in one place, and show clues whenever you hover your mouse over a link</p>    <p>You can enter pinned mode by clicking {clueframeLock, sprite} in the toolbar, or by pressing the Pinned Mode Hotkeys whilst hovering over a link.<p>    <p>Pinned mode is automatically engaged when you start playing video or audio items inside the Clueviewer.</p>    <p>To unpin the {clueframe} press {close, sprite} or hit the Hotkeys again.</p>","hint.navigationlink":'<h3>About Site Navigation links</h3>    <p>Site navigation links are small links (a small image, or 1-3 words) that go to internal site pages,     and when used on such links Linkclues often simply get in the way.</p>    <p>Clueviews of these links are often not very useful, you\'re better off     just clicking the link. So to prevent Interclue from being distracting on such links,    we recommend the following option:</p>    <div>        <label><input class="toggle" id="ajax-summariser-use-tiny-icons" type="checkbox" preferenceid="LinkScent.allowTinyIcons" toggleTarget="ajax-summariser-require-click" toggleProperties="enabled" toggleOnInit="true"/> Use tiny icons for site navigation links</label><br />        <label><input id="ajax-summariser-require-click" type="checkbox" preferenceid="Clue.requireClickToClueLinksWithTinyIcons" /> Require a click to view site navigation links</label>    </div>',"hint.tinylinkclueicons":"<p>By default Interclue uses small icons {interclueExternalTiny, sprite} on menus to keep them uncluttered.</p>    <p>Interclue assumes menu links are one or two word links pointing back to the same site.    When used in such menus, the larger Linkclue icons often get in the way. So using smaller ones is a good idea.</p>    <p>Sure, this does make then harder to click, but Interclue page summaries work best on pages that contain main body content,     and links in site navigation menus tend to lead to pages that have little main body content.</p>    <p>So most of the time, the smaller Linkclues indicate that the link goes to a page that you are better off visiting directly than previewing.</p>","invalid.server.response":"Invalid server response - Sorry, unable to process request","linkscent.mode.enabled":"Enabled","linkscent.mode.fuzzy":"{smartscents}","linkscent.mode.external":"External","linkscent.mode.disabled":"Disabled","linkscent.mode.unavailable":"Unavailable","linkscent.mode.shortdescription.enabled":"Always show {linkscent} icons","linkscent.mode.shortdescription.fuzzy":"Use Hotkeys for navigation links","linkscent.mode.shortdescription.external":"Use Hotkeys for internal links","linkscent.mode.shortdescription.disabled":"No {clues} at all","linkscent.mode.shortdescription.unavailable":"{clues} are unavailable","linkscent.mode.description.enabled":"{linkscents} are enabled for all links.","linkscent.mode.description.fuzzy":"Use the Hotkeys for navigation links.","linkscent.mode.description.external":"Use the Hotkeys for internal links.","linkscent.mode.description.disabled":"All {clues} are disabled for this page.","linkscent.mode.description.unavailable":"{clues} are unavailable for this document.","linkscent.mode.current.default.description":"Currently in {linkscentMode} mode. This is the default mode for {protocol} pages. Click to change mode for this domain","linkscent.mode.current.rule.description":"{rule} has been set to {linkscentMode}. Click to change mode for this domain.","linkscent.requires.click.to.clueview":"Click icon to show the Clueviewer","linktray.server.invalid.response":"<h1>Sorry, the server is unavailable at this time</h1>            <div>An error occured whilst trying to save your link</div>","login.invalid.server.response":"Sorry, the server sent an invalid response. Try Again?","login.title":"{app.name} - Login","login.username":"Username","login.password":"Password","login.connected.to.server":"Contacted server...","login.logging.in":"logging in...","login.error.name.required":"{login.username} is required","login.error.password.required":"{login.password} is required","login.connecting.to.server":"connecting to server...","metadata.delicious.error.server.unavailable":"Sorry, the Del.icio.us server is unavailable at this time.","metadata.delicious.tagged":'This url has been tagged {tagCount} times for the term "{tagText}"',"metadata.delicious.postcount":"{postCount} posts","metadata.delicious.error.no.records":"The Del.icio.us server has no records for this url.","metadata.delicious.fetching.tag.cloud":"fetching tag cloud ...","metadata.delicious.add":"Add to my del.icio.us","metadata.digg.title":"Digg This","metadata.confirm.remove.block":"Are you sure you want to remove this block?","metadata.feeds.title":"Feeds","metadata.feeds.none":"No links to rss or atom feeds were found in this document","metadata.languageinfo.title":"Language","metadata.languageinfo.list.before":"Document contains characters in the following languages:","metadata.languageinfo.list.after":"","metadata.link.more":"Add/Remove {metadata}...","metadata.languageinfo.none":"Unicode","metadata.downloadablefiles.files":"filename","metadata.downloadablefiles.extension":"ext","metadata.downloadablefiles.title":"Files","metadata.downloadablefiles.none":"No links to downloadable files found in this document","metadata.microsummary.title":"Live Title","metadata.microsummary.fetching":"fetching...","metadata.microsummary.xmltransformation":"Error: Unable to apply xslt.","metadata.microsummary.description":"Microsummaries are short summaries of web pages that are used to convey more information than page titles. Microsummaries are regularly updated to reflect content changes in web pages.","metadata.microsummary.none":"This page does not contain a plain text microsummary","metadata.thumbnail.loading":" ","metadata.thumbnail.not.available":"No Image Available","metadata.thumbnail.not.found":"No Image Found","metadata.title.links":"Links","metadata.title.internal":"Internal","metadata.title.external":"External","metadata.title.other":"Other","metadata.title.published":"Date","metadata.title.text":"Text","metadata.title.words":"Words","metadata.title.files":"Files","metadata.title.stats":"Statistics","metadata.published.title":"Date","metadata.published.none":"Unable to extract any date information about this page","metadata.stats.title":"Statistics","metadata.stats.none":"Unable to extract any statistics from this page","metadata.files.content":"{fileCount} unique external files will be loaded with this document","metadata.words.percent.in.clue":"appears in this clue","metadata.words.additional.content":"appears to be additional content","metadata.words.in.template":"appears to be in the page template","metadata.date.meta.tag":"Date extracted from HTML meta tag","metadata.date.headers":"Date extracted from HTTP headers","metadata.date.url":"Date extracted from page URL","metadata.partial.document.title":"Incomplete Document","metadata.partial.document.warning":"We couldn't download or parse the entire document in the time given so these results are only for a partial document","prefs.linkscent.on.by.default.warning":"You have {linkscents} enabled on all links by default.\nAre you sure you want to do this?","prefs.error.login":"Sorry, you need to login before you can alter your preferences.","prefs.title":"{app.name} : Options","prefs.linkscent.title":"Show {linkscents}","prefs.linkscent.description":"after hovering over a link for ","prefs.clueframe.title":"Show {clueframe}","prefs.clueframe.showevent.click":"When you click on a {linkscent} icon","prefs.clueframe.showevent.hover":"When you hover over a {linkscent} icon for ","prefs.clueframe.showevent.linkhover":"When you hover over a link for ","prefs.hotkey.title":"{clueframe} Hotkeys","prefs.hotkey.description":"Choose the key combination you want to use to show the {clueframe} immediately for the link directly beneath the cursor.","prefs.hotkey.enabled":"Enable the Hotkeys","prefs.performance.title":"Performance Tweaks","prefs.performance.favicons.title":"Fetch {favicons} on hover","prefs.performance.favicons.description":"After page load should we fetch any favicons from external sites.","prefs.performance.faviconsmax.title":"Maximum {favicons} to fetch","prefs.performance.faviconsmax.description":'The maximum number of {favicons} to fetch on page load (enter "-1" for all).',"prefs.performance.content.title":"Maximum Content to fetch","prefs.performance.content.description":"How much HTML/Text content (in kB) should we retrieve on in order to generate a summary.","prefs.performance.headers.title":"Fetch headers on hover","prefs.performance.headers.description":"When hovering over a link should we request header content about the document to provide more information about the page at minimal data cost (~1kB).","prefs.performance.prefetchcontent.title":"Fetch text content on hover","prefs.performance.prefetchcontent.description":"When hovering over a link should we retrieve the destination page ready to be summarised. <em>Note: secure files (https:) will not be fetched until requested</em>","prefs.performance.thumbnail.title":"Fetch thumbnail on hover","prefs.performance.thumbnail.description":"Should we attempt to download the thumbnail image when you hover over a link?","prefs.summary.title":"Content Clues","prefs.summary.legend.title":" Show Legend Block","prefs.summary.wordcount.title":"Summary Wordcount","prefs.summary.wordcount.description":'How much of the destination page\'s content do you want to appear in each summary.<br />Enter "0" for all the content we can find.',"prefs.summary.maximagesize":" Maximum Image Size","prefs.summary.maximagesize.description":"Maximum size of images that will be previewed.","privacy.rule.content":'This URL matches one of your <a href="javascript:;" prefpage="privacy">Privacy Filter rules</a>. No 3rd party {metadata} will be fetched.',"privacy.rule.content.https":"This is a secure (https) URL. To protect your privacy Interclue will not fetch any 3rd party {metadata}.","privacy.rule.list.title":"Rules matched","privacy.rule.title":"Privacy Filter","security.domain":"Domain","security.mode":"Mode","security.click.to.edit":"Click to edit","security.add.rules":"Add/Edit your own rules","security.safeurl.domain":"Domain","security.safeurl.pages":"Pages","security.safeurl.override":"Override","security.safeurl.url":"URL","stats.estimated.explanation":"Estimated from previous stats","stats.title.today":"Today","stats.title.yesterday":"Yesterday","stats.title.last.7.days":"Last 7 days","stats.title.last.30.days":"Last 30 days","stats.title.last.365.days":"Last 365 days","stats.title.7.day.estimate":"7 Day <br />Estimate *","stats.title.30.day.estimate":"30 Day <br />Estimate *","stats.title.365.day.estimate":"365 Day <br />Estimate *","stats.title.total.pages.viewed":"Total pages viewed","stats.title.total.pages.time":"Total time reading pages","stats.title.average.page.time":"Average time per page","stats.title.total.clues.viewed":"Total {clues} viewed","stats.title.total.clues.time":"Total time reading {clues}","stats.title.average.clue.time":"Average time per {clue}","stats.title.total.clickthroughs":"Pages read after viewing clue","stats.title.roi":"Time saved by not reading unnecessary pages","stats.statusbarlabel.tooltip":"Clues viewed since {date}","tutorial.other.cursors.title":"{cluecursors}","tutorial.other.cursors.info":"Some special links do not point to web pages or documents, but rather cause actions to occur. They may invoke an external program or use scripting to alter content within a page. These links are given different mouse cursors.","tutorial.clueframe.title":"The {clueframe}","tutorial.clueframe.hide":"Hide the {clueframe}.","tutorial.clueframe.info":"This is a {clueframe}. It contains more detailed information about the link's destination. In this case, a short summary of the text found on the destination page.    You can close the Clueviewer by moving your mouse away from the Clueviewer and the link.","tutorial.click.to.continue":'<a id="tutorial-next-step" href="javascript:;">Click here to continue »</a>',"tutorial.click.to.finish":'<a id="tutorial-close" href="javascript:;">Click here to close the tutorial.</a>',"tutorial.cursors.links":'<ul id="tutorial-cursors-links-list">    <li><a id="cursorLink1" href="mailto:admin@{app.domain}">email links (mailto:)</a></li>    <li><a id="cursorLink2" href="javascript:alert(\'Hello\')">scripting events</a></li>    </ul>',"tutorial.different.links.title":"Different summaries for different files","tutorial.different.links.info":"Links to non-HTML pages show details about the document. It's filename, size, and last modified date, if they are provided by the destination server.","tutorial.finished.title":"Finished!","tutorial.finished.info":'<p>    This is the end of the tutorial. The {app.name} addon does a lot more than what you\'ve seen here, but you now know enough to use it effectively,    and we\'re here to save you time, not have you spend it on endless tutorials.    </p>    <p>To alter any options just click the options button {preferences, sprite} in the statusbar.<br />        To run this tutorial again, click the tutorial button {tutorial, sprite},<br />        To send us feedback about any problems or suggestions you have for new clues, hit the feedback button {feedback, sprite},        which you can find on the Clueviewer or by right clicking on the Interclue status bar icons.    </p>    <p>If you haven\'t done so already, you might want to <a target=_blank href="http://interclue.com/tour-intro.html">take the tour</a> on the Interclue Website.     There\'s more info about:    <ul>    <li><a target=_blank href="http://interclue.com/tour-linkclues.html">Linkclues</a></li>    <li><a target=_blank href="http://interclue.com/tour-clueviewer.html">The Clueviewer</a></li>    <li><a target=_blank href="http://interclue.com/tour-clueviews.html">Clueviews</a></li>    <li><a target=_blank href="http://interclue.com/tour-options.html">and more</a></li>    </ul>    </p>    <p>Thank you for installing Interclue. We\'re looking forward to making your time on the internet<ul>   <li>Less irritating,</li> <li>Less distracting,</li> <li>More productive,</li> <li><strong>More clueful</strong></li></ul> </p>',"tutorial.hiding.clueframe.title":"Hiding the {clueframe}","tutorial.hiding.clueframe.info":"Moving your mouse off the link or away from the {clueframe} makes the {clueframe} disappear.","tutorial.hotkey.title":"Hotkeys & Pinned Mode","tutorial.hotkey.info":"Some links (such as links on a secure page or links inside navigation blocks) do not have {linkscents} by default. These links are given a special mouse cursor so you can identify them.","tutorial.hotkey.instruc":"Move your mouse over the link, and press the Hotkeys {hotKeyText}.","tutorial.hotkey.info2":"When you hit the Hotkeys while hovering over a link, the {clueframe} appears in Pinned Mode.    When in Pinned mode links are automatically Clueviewed as you mouse over them.<br />    You can resize the Clueviewer by dragging the resize handle {resizer, sprite} in the bottom right corner of the Clueviewer.","tutorial.hotkey.instruc2":"Resize the Clueviewer.","tutorial.hotkey.close.info":"To close the Clueviewer when it is pinned you need to click the close {close, sprite} button in the top right corner.","tutorial.hotkey.close.instruc":"Close the Clueviewer.","tutorial.hotkey.link":'<ul><li><a id="hotkeyLink" class="noclues" href="{url.tutorial.link3}">Just another link</a</li></ul>',"tutorial.hotkey.instruc3":"Close the {clueframe} by pressing the Hotkeys {hotKeyText} again.","tutorial.hover.mouse.over.link":"Hover your mouse over the link","tutorial.hover.mouse.over.a.link":"Hover your mouse over a link","tutorial.hover.mouse.over.linkscent":"Hover your mouse over the {linkscent} icon (to the right of the link)","tutorial.image.click":"Click the image","tutorial.image.title":"Image previews","tutorial.image.info":"The image has been shrunk to fit within the {clueframe}. By clicking on the image the image will be shown full size.","tutorial.instruct.display.clueframe":"Hover your mouse over the link and move it over the {linkscent} icon to display the {clueframe} for the new link.","tutorial.link1":'<div style="margin-top:-120px"><a id="link1" target="_blank" interclue-disable-clues="true" href="{url.tutorial.link1}">{app.name}</a></div>',"tutorial.link2":'<a id="link2" href="{url.tutorial.pdf}">something different</a>',"tutorial.clueframe.info.resize":"This is a {clueframe}. It contains more detailed information about the link's destination. In this case, a short summary of the text found on the destination page.    You can resize the {clueframe} by using the resize handle in the bottom right corner.","tutorial.clueframe.instruc.resize":"Resize the {clueframe}","tutorial.clueframe.info.drag":"The {clueframe} can be moved around the page by dragging the green part of it's toolbar.","tutorial.clueframe.instruc.drag":"Try dragging the {clueframe} around the screen.","tutorial.clueframe.info.hide":"The Clueviewer will close shortly after you move your mouse away from the Clueviewer and the link.","tutorial.clueframe.instruc.hide":"Close the clueviewer","tutorial.linkscent.title":"{linkscents} and the {clueframe}","tutorial.linkscent.info":"The images to the right of the link are {linkscent} icons. They tell you a little bit of information about the destination and type of the link.","tutorial.nextprevbuttons.title":"Quickly jump between links","tutorial.nextprevbuttons.info":"<p>As well as simply showing you what's at the end of one link,     Interclue can help you speedily look at a whole bunch of links.</p>    <p>Take a look at this fragment of a typical Google results page.    Note the small links underneath each search result.     The arrow buttons move you from one search result to the next,     ignoring the lesser links. In general, the arrow buttons will     move you to the next (or previous) link that's most similar to the one you just previewed,     rather than to the next link on the page.     They're very handy when browsing search results, or any other list of links.</p>","tutorial.nextprevbuttons.instruc":'Clueview a search result, then use the previous link {prevSimilarLink, sprite} and next link {nextSimilarLink, sprite} buttons to move between the results. <a id="tutorial-next-step" href="javascript:;">Click here to continue »</a>',"tutorial.nextprevbuttons.content":'<div id="google-search-results">    <div class="google-search-result">        <div class="google-title">            <a href="http://wiki.answers.com/Q/What_does_it_mean_to_be_Rickrolled">WikiAnswers - Rickrolled</a>        </div>        <div class="google-description">            Rickrolling is a new trend in online posting, in which a link is apparently ... What is Rickrolling?        </div>        <div class="google-info">            <span class="google-url">wiki.answers.com/Q/What_does_it_mean_to_be_Rickrolled - 51k - </span>            <a class="google-other" href="http://72.14.253.104/search?q=cache:EjxGTfWezH0J:wiki.answers.com/Q/What_does_it_mean_to_be_Rickrolled+rickrolling&hl=en&ct=clnk&cd=3&gl=nz&client=firefox-a">Cached</a> -             <a class="google-other" href="http://www.google.co.nz/search?hl=en&safe=off&client=firefox-a&rls=org.mozilla:en-US:official&q=related:wiki.answers.com/Q/What_does_it_mean_to_be_Rickrolled">Similar pages</a>        </div>    </div>    <div class="google-search-result">        <div class="google-title">            <a href="http://en.wikipedia.org/wiki/Rick_Astley">Rick Astley - Wikipedia, the free encyclopedia</a>        </div>        <div class="google-description">            The song "Never Gonna Give You Up" \'s campy music video became the basis for an Internet phenomenon known as "rickrolling".        </div>        <div class="google-info">            <span class="google-url">en.wikipedia.org/wiki/Rick_Astley - 57k - </span>            <a class="google-other" href="http://72.14.253.104/search?q=cache:qV-395ouW_8J:en.wikipedia.org/wiki/Rick_Astley+rickrolling&hl=en&ct=clnk&cd=4&gl=nz&client=firefox-a">Cached</a> -             <a class="google-other" href="http://www.google.co.nz/search?hl=en&safe=off&client=firefox-a&rls=org.mozilla:en-US:official&q=related:en.wikipedia.org/wiki/Rick_Astley">Similar pages</a>        </div>    </div>    <div class="google-search-result">        <div class="google-title">            <a href="http://www.urbandictionary.com/define.php?term=rickroll">Urban Dictionary: rickroll</a>        </div>        <div class="google-description">            rickroll rickrolled rick astley rickrolling 4chan duckroll roll rick rolled rickrolld        </div>        <div class="google-info">            <span class="google-url">www.urbandictionary.com/define.php?term=rickroll - 26k - </span>            <a class="google-other" href="http://72.14.253.104/search?q=cache:Ip-73CfuuhgJ:www.urbandictionary.com/define.php%3Fterm%3Drickroll+rickrolling&hl=en&ct=clnk&cd=1&gl=nz&client=firefox-a">Cached</a> -             <a class="google-other" href="http://www.google.co.nz/search?hl=en&safe=off&client=firefox-a&rls=org.mozilla:en-US:official&q=related:www.urbandictionary.com/define.php%3Fterm%3Drickroll">Similar pages</a>        </div>    </div></div>',"tutorial.nonHTML.title":"File {clues}","tutorial.cursors.title":"{cluecursors}","tutorial.enableDisableInterclue.title":"Enabling and Disabling Interclue","tutorial.enableDisableInterclue.info":'<p>There are a number of ways to temporarily turn off Interclue. You can shut it down entirely or just disable it on selected sites. This is done via the menu that appears when you click the Interclue icon {interclue, sprite} in your status bar.</p><p>There are four options:<ul>    <li><img src="chrome://interclue/skin/interclue-blue.png"> Re-enable Interclue for this domain, if you have previously disabled it.</li>    <li><img src="chrome://interclue/skin/interclue-grey-cross.png"> Disable Interclue whenever you are on the current domain.</li>    <li><img src="chrome://interclue/skin/interclue-grey-rotate.png"> Disable Interclue until you restart Firefox or click the <img src="chrome://interclue/skin/interclue-grey-rotate.png"> button on the status bar.</li>    <li><img src="chrome://interclue/skin/interclue-grey.png"> Turn off Interclue until you click the <img src="chrome://interclue/skin/interclue-grey.png"> button on the status bar.</li></ul></p>',"tutorial.otherCursors.title":"Other {cluecursors}","tutorial.options.title":"Options","tutorial.options.info":'    <p>{app.name} has a lot of options. We believe in letting you have as much control as possible over your browsing experience.</p>    <p>     On the <a href="javascript:;" prefpage="basic">basic tab</a> you can answer 3 easy questions and Interclue will set the most important options for you. That\'s usually enough for most people.<br />    On the <a href="javascript:;" prefpage="advanced">advanced tab</a> you can completely control how Interclue behaves. <br />    Here are some of the things you can tweak:         <ul>            <li>Adjust when the <a href="javascript:;" prefpage="linkclue">{linkscents} and {clueframe} will appear</a></li>            <li><a href="javascript:;" prefpage="clueframebuttons">Customize the buttons</a> that appear in the {clueframe} and statusbar</li>            <li>Choose the <a href="javascript:;" prefpage="metadata">{metadata}</a> that appear within your summaries.</li>            <li>Change <a href="javascript:;" prefpage="summaries">fonts</a>, <a href="javascript:;" prefpage="linkclue">hover times</a>, <a href="javascript:;" prefpage="hotkey">hotkeys</a> and <a href="javascript:;" prefpage="advanced">heaps more...</a></li>        </ul>    </p>    <p>        You can access the options by right clicking the Interclue icon {interclue, sprite} in the statusbar and selecting {preferences, sprite} Interclue Options on the context menu.        Have a play, and if there are any more options you want to see just use the {feedback, sprite} Interclue feedback menu item to send us your feedback.</p>',"tutorial.linkscentmodes.instruct":"Try disabling {linkscents} for internal links ({interclueExternal, sprite}).","tutorial.linkscentmodes.title":"{linkscent} modes","tutorial.linkscentmodes.info":'You will find that on some websites you want clues on some links and not others. For that reason we have four Linkclue "modes":        <ul><li>{interclueEnabled, sprite} Enabled for all links</li>        <li>{interclueFuzzy, sprite} No {linkscents} on navigation links.</li>        <li>{interclueExternal, sprite} No {linkscents} on internal links.</li>        <li>{interclueDisabled, sprite} Disabled for all links (secure [https:] pages are disabled by default).</li>        </ul>        The current mode is displayed in the browser status bar (eg {interclueEnabled, sprite}), and you can change the mode for the current site by clicking that icon.        <hr />        <p>In the same menu you can disable Interclue completely by selecting         <ul>            <li>                {interclueUnavailable, sprite} Turn off {app.name}            </li>        </ul>',"tutorial.mouse.cursors":"{cluecursors}","tutorial.move.mouse.off.link":"Close the Clueviewer","tutorial.title":"{app.name} Tutorial","tutorial.welcome.title":"Thanks for installing {app.name}!","tutorial.welcome.info":'<img src="chrome://interclue/content/cluecore/tutorial/interclue.png" border="0" />',"tutorial.welcome.start.tutorial":'<a id="tutorial-next-step" href="javascript:;">Click here to start the tutorial »</a>',"unit.milliseconds":"milliseconds","unit.words":"words","unit.kb":"kB","unit.days":"days","unit.weeks":"weeks","unit.months":"months","unit.years":"years","unit.pixels":"pixels","update.available.experimental":"A new Experimental build ({version}) is available!","update.available.nightly":"A new Nightly build ({version}) is available!","update.available.beta":"A new Beta version ({version}) is available!","update.available.stable":"A new version of Interclue (build {version}) is available!","update.check.failed":"Update check failed due to server problems!","update.check.success":"Checking for new version...","update.connecting.to.server":"Connecting to server...","update.have.latest.version":"You have the latest version","update.check.invalid.data":"Update check failed!\nInvalid or corrupt data retrieved from server.","update.download.now":"Would you like to install it now?","update.check.download.failed":"Sorry, an error occured whilst trying to download the new version.","warning.frameset.unable.to.find.clueframe":"Sorry, Interclue is unable to show Clueviews on certain framed pages",__IE_fix__:""};
  7159. Klib.messages=['Help us <a href="{url.spread.the.word}">make the planet more clueful</a>.','Learn how to make Interclue <a href="{url.donate}">better and faster</a>','Got a question? <a bugreporter="Other" bugreportertab="general" href="javascript:;">Ask away</a>, or try the <a href="{url.faq}">FAQ</a>.','Something needs improving? <a bugreporter="SuggestImprovement" bugreportertab="general" href="javascript:;">We\'re all ears<a/>.','See how to <a href="javascript" prefpage="presets">make Interclue go faster or slower</a>'];
  7160. Klib.Strings.bork={cancel:"BorkBorkCancel","app.id":"AFewClues","app.name":"A Foo Clooes","prefs.title":"{app.name} : Oopshuns : ferseeun {Klib.App.version}.{Klib.App.build}","login.invalid.server.response":"Surry, zee serfer sent un infeleed respunse-a. Try Egeeen?","clue.error.request.timed.out":'<h1>Reqooest teemed oooot</h1><p>Surry, zee pege-a <a href="{url}">{url}</a> tuuk lunger thun {timeout} secunds tu doonlued.su ve-a cunnut prufeede-a a soommery fur yuoo.</p><p>Iff yuoo vunt tu veeet lunger thun {timeout} secunds fur peges tu doonlued in footoore-a, zeen oopee zee oopshuns deeelug und chunge-a zee "ClooeScreept deffoolt teemeuoot" setteeng.',"clue.error.generic":"<h1>{status} : {statusText}</h1><div>Surry, ve-a vere-a uneble-a tu retreeefe-a uny cuntent frum {url}</div>","update.connecting.to.server":"Cunnecteeng tu serfer...","update.check.success":"Checkeeng fur noo ferseeun...","update.check.failed":"Feeeled tu cunnect tu serfer!","update.available":"Noo updeted is efeeeleble-a!","update.have.latest.version":"Yuoo hefe-a zee letest ferseeun.","bugreporter.report.received":"Thunks fur yuoor repurt.","ajaxform.connecting.to.server":"Cunnecteeng tu serfer...","ajaxform.processing.request":"Prucesseeng reqooest...","ajaxform.server.error":"Surry, zee serfer is doon fur meeentenunce-a et zee mument.","ajaxform.form.error":"Zeere-a ves un irrur in zee furm.","ajaxform.success":"Dune-a!","ajax.error.cannot.find.server":"Feeeled tu lucete-a zee serfer.","ajax.error.unknown":"Oonknoon irrur","ajax.error.maximum.length.exceeded":"Mexeemoom lengt ixceeded","ajax.error.permission.denied":"Permeessiun deneeed.","ajax.error.aborted":"Reqooest helted","ajax.error.request.timed.out":"Reqooest timed oooot.","ajax.error.json.decoding.error":"Infeleed JSON streeng",done:"Dune-a",IEFix:""};
  7161. if(Klib.install("AjaxForm",0.1)){Klib.AjaxForm.Obj=function(C){var D=this;
  7162. D.doc=C.ownerDocument;
  7163. D.form=C;
  7164. D.method=C.method;
  7165. D.action=C.action;
  7166. D.elements=C.elements;
  7167. D.submits=[];
  7168. D.msgbox=null;
  7169. D.onSuccess=function(){};
  7170. D.lastMsg="";
  7171. D.onBeforeSubmit=function(){return true
  7172. };
  7173. D.overrideFieldsList=[];
  7174. D.testing=false;
  7175. function B(){D.submits=[];
  7176. for(var E=0;
  7177. E<D.elements.length;
  7178. E++){if(D.elements[E].tagName=="INPUT"&&D.elements[E].type=="submit"){D.submits.push(D.elements[E])
  7179. }}}B();
  7180. function A(){var E=Klib.getEles(".ajaxform-msgbox",D.form);
  7181. if(E.length==1){D.msgbox=E[0]
  7182. }else{if(E.length>1){Klib.error(Error("Klib.AjaxForm: Too many elements with class of ajaxform-msgbox in form"),D.form)
  7183. }else{Klib.error(Error("Klib.AjaxForm: Cannot find element with class of ajaxform-msgbox in form"),D.form)
  7184. }}}A();
  7185. D.toggleSubmits=function(E){for(var G=0;
  7186. G<D.submits.length;
  7187. G++){var F=D.submits[G];
  7188. F.disabled=!E;
  7189. if(E){Klib.removeClass(F,"disabled")
  7190. }else{Klib.addClass(F,"disabled")
  7191. }}};
  7192. D.showMessage=function(G,F,E){D.lastMsg=G;
  7193. D.msgbox.innerHTML=G;
  7194. Klib.replaceClass(D.msgbox,"message,loading,success,error",F);
  7195. if(E!==undefined){D.toggleSubmits(E)
  7196. }};
  7197. D.extractElementValue=function(E){if(E.tagName=="INPUT"){switch(E.type.toLowerCase()){case"checkbox":case"radio":return E.checked?E.value:null;
  7198. break;
  7199. default:return E.value
  7200. }}else{if(E.tagName=="SELECT"){return E.value
  7201. }else{if(E.tagName=="TEXTAREA"){return E.value
  7202. }}}return null
  7203. };
  7204. D.handleHead=function(E){D.showMessage(Klib.string("ajaxform.processing.request"),"loading",false);
  7205. return true
  7206. };
  7207. D.handleResponse=function(G){if(G.error){D.showMessage(Klib.string("ajaxform.server.error"),"error",true);
  7208. Klib.error("AjaxForm.handleResponse",G.status,G.statusText,G.responseText)
  7209. }else{if(G.json&&G.json.error){Klib.error("AjaxForm error",G.json.error,G.json);
  7210. D.showMessage(G.json.error,"error",true);
  7211. if(G.json.errors){for(var E=D.elements.length-1;
  7212. E>=0;
  7213. E--){var F=D.elements[E];
  7214. if(G.json.errors[F.id]){F.focus();
  7215. Klib.addClass(F,"error")
  7216. }else{Klib.removeClass(F,"error")
  7217. }}}}else{D.showMessage(Klib.string("ajaxform.success"),"success",true);
  7218. D.onSuccess(D)
  7219. }}};
  7220. D.shouldSendField=function(E){if(!E.name){return false
  7221. }if(E.disabled){return false
  7222. }if(D.overrideFieldsList&&D.overrideFieldsList.length){return Klib.inArray(E.name,D.overrideFieldsList)
  7223. }else{return true
  7224. }};
  7225. D.handleSubmit=function(E){D.toggleSubmits(false);
  7226. D.showMessage(Klib.string("ajaxform.collecting.form.data"),"loading");
  7227. if(D.onBeforeSubmit(D)){var J=new Klib.Ajax.Obj();
  7228. J.url=D.action;
  7229. J.method=D.method;
  7230. J.isJson=true;
  7231. for(var G=0;
  7232. G<D.elements.length;
  7233. G++){var I=D.elements[G];
  7234. if(D.shouldSendField(I)){var F=D.elements[G].name;
  7235. var H=D.extractElementValue(D.elements[G]);
  7236. if(H!==null){J.addData(F,H)
  7237. }}}if(!Klib.isIE){J.onHead=D.handleHead
  7238. }J.onComplete=D.handleResponse;
  7239. D.showMessage(Klib.string("ajaxform.connecting.to.server"),"loading");
  7240. D.ajax=J;
  7241. if(D.testing){D.showMessage("== AjaxForm : just testing ==","loading");
  7242. Klib.setTimer(function(){D.handleResponse(J)
  7243. },2000)
  7244. }else{D.ajax.send()
  7245. }}else{if(D.lastMsg==Klib.string("ajaxform.collecting.form.data")){D.showMessage(Klib.string("ajaxform.form.error"),"error")
  7246. }D.toggleSubmits(true)
  7247. }E.halt();
  7248. return false
  7249. };
  7250. Klib.addEvent(D.form,"submit",D.handleSubmit)
  7251. }
  7252. }if(Klib.install("Image",0.1)){Klib.Images=Klib.Images||[];
  7253. Klib.Image.pixel=function(){return Klib.skinUrl()+"/pixel.gif"
  7254. };
  7255. Klib.Image.preloadAllShowProgress=function(A,B){};
  7256. Klib.Image.removeEvents=function(A){Klib.removeAllEvents(A,"load");
  7257. Klib.removeAllEvents(A,"error")
  7258. };
  7259. Klib.Image.handleLoaded=function(A){var B=A.source.src;
  7260. Klib.Image.removeEvents(A.source)
  7261. };
  7262. Klib.Image.handleError=function(A){var B=A.source.src;
  7263. Klib.warning("Image failed to load",B);
  7264. Klib.Image.removeEvents(A.source)
  7265. };
  7266. Klib.Image.preloadAllProgress=function(A){Klib.Image.removeEvents(A.source);
  7267. Klib.Image.preloadAllLoaded++;
  7268. if(Klib.Image.preloadAllOnProgress){Klib.Image.preloadAllOnProgress(Klib.Image.preloadAllLoaded,Klib.Image.preloadAllTotal)
  7269. }};
  7270. Klib.Image.preloadAll=function(A,E){Klib.Image.preloadAllLoaded=0;
  7271. Klib.Image.preloadAllTotal=A.length;
  7272. Klib.Image.preloadAllOnProgress=E;
  7273. for(var D=0;
  7274. D<A.length;
  7275. D++){var C=A[D];
  7276. var B=new Image();
  7277. Klib.addEvent(B,"load",Klib.Image.handleLoaded);
  7278. Klib.addEvent(B,"error",Klib.Image.handleError);
  7279. if(E){Klib.addEvent(B,"load",Klib.Image.preloadAllProgress);
  7280. Klib.addEvent(B,"error",Klib.Image.preloadAllProgress)
  7281. }B.src=C
  7282. }};
  7283. Klib.Image.preload=function(C,B,D){var A=document.createElement("img");
  7284. if(B){Klib.addEvent(A,"load",function(E){B(E);
  7285. document.body.removeChild(A)
  7286. })
  7287. }if(D){Klib.addEvent(A,"error",function(E){D(E);
  7288. document.body.removeChild(A)
  7289. })
  7290. }A.src=C;
  7291. document.body.appendChild(A)
  7292. };
  7293. Klib.Image.resizeDimentions=function(B,D,C){var A=(D/B.width);
  7294. var F=(C/B.height);
  7295. var E=(A<F)?A:F;
  7296. if(E<1){B.origWidth=B.width;
  7297. B.origHeight=B.height;
  7298. B.width=parseInt(B.width*E);
  7299. B.height=parseInt(B.height*E)
  7300. }return B
  7301. };
  7302. Klib.Image.preloadSuccess=function(A){};
  7303. Klib.Image.preloadFailed=function(A){Klib.warning("Preload Failed "+A.source.src)
  7304. };
  7305. Klib.Image.handleLogin=function(){var A=Klib.skinUrl();
  7306. Klib.Image.preload(A+"/pixel.gif");
  7307. Klib.Image.preload(A+"/linkscentDefault.png");
  7308. Klib.Image.preload(A+"/linkscentExternal.png")
  7309. };
  7310. Klib.GEvent.addEvent("login",Klib.Image.handleLogin);
  7311. Klib.KImage=function(A){var B=this;
  7312. B.url=A;
  7313. B.img=null;
  7314. B.exists=null;
  7315. B.width=0;
  7316. B.height=0;
  7317. B.origWidth=0;
  7318. B.origHeight=0;
  7319. B.zoom=0;
  7320. B.timeout=15;
  7321. B.state="init";
  7322. B.handleError=function(){B.state="error";
  7323. B.exists=false;
  7324. B.finish()
  7325. };
  7326. B.handleLoad=function(){B.state="success";
  7327. B.exists=true;
  7328. B.finish()
  7329. };
  7330. B.handleAbort=function(){B.state="aborted";
  7331. B.exists=false;
  7332. B.finish()
  7333. };
  7334. B.fetch=function(C){B.state="fetching";
  7335. B.onComplete=C||B.onComplete;
  7336. B.img=new Image();
  7337. B.img.onabort=B.handleAbort;
  7338. B.img.onerror=B.handleError;
  7339. B.img.onload=B.handleLoad;
  7340. B.img.src=B.url;
  7341. B.endTime=Klib.timestamp(true)+B.timeout;
  7342. B.fixNoEventFiredError()
  7343. };
  7344. B.fixNoEventFiredError=function(){if(B.state=="fetching"&&B.img&&!B.img.complete&&(Klib.timestamp(true)<B.endTime)){Klib.setTimer(B.fixNoEventFiredError,500)
  7345. }};
  7346. B.finish=function(){B.width=B.img.width;
  7347. B.height=B.img.height;
  7348. B.origWidth=B.img.width;
  7349. B.origHeight=B.img.height;
  7350. B.zoom=1;
  7351. if(B.onComplete){B.onComplete(B)
  7352. }};
  7353. B.resize=function(C){B.zoom=(B.zoom*C);
  7354. B.height=parseInt(B.height*C);
  7355. B.width=parseInt(B.width*C)
  7356. };
  7357. B.sizeToFit=function(D,C){if(B.width>D){B.resize(D/B.width)
  7358. }if(B.height>C){B.resize(C/B.height)
  7359. }};
  7360. B.sizeHTML=function(){if(B.width&&B.height){return'width="'+B.width+'" height="'+B.height+'" origwidth="'+B.origWidth+'" origheight="'+B.origHeight+'"'
  7361. }else{return""
  7362. }}
  7363. }
  7364. }if(Klib.install("Selection",0.1)){Klib.getSelection=function(C){try{C=C||document;
  7365. var B=Klib.getWin(C);
  7366. if(!B){return false
  7367. }else{if(B.getSelection){return B.getSelection()
  7368. }else{if(C.getSelection){return B.getSelection()
  7369. }else{if(C.selection){return C.selection
  7370. }}}}}catch(A){Klib.warning("Klib.getSelection failed",A)
  7371. }return false
  7372. };
  7373. Klib.selectNone=function(C){try{if(C.body&&C.body.createTextRange){C.body.createTextRange()
  7374. }else{var A=Klib.getSelection(C);
  7375. if(A){A.removeAllRanges()
  7376. }}}catch(B){}};
  7377. Klib.getSelectedRange=function(D){try{var B=Klib.getSelection(D);
  7378. var A;
  7379. if(!B){return false
  7380. }else{if(B.rangeCount&&B.getRangeAt){A=B.getRangeAt(0)
  7381. }else{if(B.createRange){A=B.createRange()
  7382. }else{return false
  7383. }}}A.isRange=true;
  7384. A.getHtml=function(){if(this.cloneContents){var F=this.cloneContents();
  7385. var E=D.createElement("div");
  7386. E.appendChild(F);
  7387. return E.innerHTML
  7388. }else{if(this.htmlText){return this.htmlText
  7389. }else{return""
  7390. }}};
  7391. A.getText=function(){var E=this.getHtml();
  7392. E=E.replace(/<!--[\w\W]*?-->/g,"");
  7393. E=Klib.Html.removeBlockTags(E,"script|style|object|applet|frame|frameset|iframe|noscript|noframes|option");
  7394. return Klib.Html.removeTags(E,"\\w+")
  7395. };
  7396. return(A.getHtml()=="")?false:A
  7397. }catch(C){Klib.warning("Klib.getSelectedRange failed",C)
  7398. }return false
  7399. };
  7400. Klib.getSelectedHtml=function(B){B=B||document;
  7401. var A=Klib.getSelectedRange(B);
  7402. return(A)?A.getHtml():""
  7403. };
  7404. Klib.getSelectedText=function(B){B=B||document;
  7405. var A=Klib.getSelectedRange(B);
  7406. return(A)?A.getText():""
  7407. }
  7408. }if(Klib.install("FavIcon",0.1)){Klib.FavIcon.cache=new Klib.Cache.Obj("FavIcon");
  7409. Klib.FavIcon.cacheTestedUrls=new Klib.Cache.Obj("FavIcon:TestedUrls");
  7410. Klib.FavIcon.cacheHttpsAllowed=new Klib.Cache.Obj("FavIcon:HttpsAllowed");
  7411. Klib.FavIcon.prefetchCache=new Klib.Cache.Obj("FavIcon.prefetch");
  7412. Klib.FavIcon.blacklist=Klib.arrayToObject(["bydigi.com","doubleclick.net","drivecleaner.com"]);
  7413. Klib.FavIcon.getUrl=function(B){var A=Klib.Url.parse(B);
  7414. if(A){return"http://"+A.domain+"/favicon.ico"
  7415. }else{return""
  7416. }};
  7417. Klib.FavIcon.generateUrl=function(B,C){var A=Klib.Url.parse(B);
  7418. if(A.success&&(A.protocol=="http:"||A.protocol=="https:")){if(A.protocol=="https:"&&!Klib.FavIcon.cacheHttpsAllowed.exists(A.domain)){A.protocol="http:"
  7419. }switch(C){case"domain":return A.protocol+"//"+A.domain+"/favicon.ico";
  7420. case"basedomain":return A.protocol+"//"+A.basedomain+"/favicon.ico";
  7421. case"full":return A.protocol+"//"+A.domain+A.path+A.filename;
  7422. default:Klib.error("Unknown type in Klib.FavIcon.generateUrl()",C);
  7423. break
  7424. }}return""
  7425. };
  7426. Klib.FavIcon.createLink=function(A,C){var B=Klib.FavIcon.getCurrFavIconUrl(A);
  7427. if(!B&&!C){B=Klib.FavIcon.getUrl(A)
  7428. }if(B){return Klib.Template.quick('<a class="interclue-faviconlink" href="{$url}"><img src="{$src}" /></a>',{url:A,src:B})
  7429. }else{return""
  7430. }};
  7431. Klib.FavIcon.getCurrFavIconUrl=function(A){var C=Klib.FavIcon.getUrl(A);
  7432. var B=Klib.FavIcon.cache.get(C);
  7433. return(B&&B.exists&&B.url)?B.url:""
  7434. };
  7435. Klib.FavIcon.icon=function(A){var B=this;
  7436. B.origUrl=A;
  7437. B.parsedUrl=Klib.Url.parse(A);
  7438. if(B.parsedUrl.success){B.isValidUrl=true;
  7439. B.blacklisted=Klib.FavIcon.blacklist[B.parsedUrl.basedomain]?true:false;
  7440. B.baseUrl=Klib.FavIcon.generateUrl(B.parsedUrl,"basedomain");
  7441. B.subUrl=Klib.FavIcon.generateUrl(B.parsedUrl,"domain");
  7442. B.id=B.subUrl;
  7443. B.iconUrl="";
  7444. B.exists=false;
  7445. B.onComplete=function(){};
  7446. B.handleLoad=function(C){if(B.img.width>1&&B.img.width>1){Klib.FavIcon.cacheTestedUrls.add(B.currUrl,"success");
  7447. Klib.FavIcon.cache.add(B.id,B);
  7448. B.removeEvents();
  7449. B.exists=true;
  7450. B.url=B.currUrl;
  7451. B.onComplete(B);
  7452. Klib.FavIcon.updateCachedIcon(B)
  7453. }else{B.handleError(C)
  7454. }};
  7455. B.handleError=function(C){Klib.FavIcon.cacheTestedUrls.add(B.currUrl,"failed");
  7456. if(B.blacklisted){B.exists=false;
  7457. B.onComplete(B)
  7458. }else{if((B.currUrl==B.subUrl)&&(B.subUrl!=B.baseUrl)){B.removeEvents();
  7459. B.fetchIcon(B.baseUrl)
  7460. }else{B.removeEvents();
  7461. B.exists=false;
  7462. B.onComplete(B)
  7463. }}Klib.FavIcon.updateCachedIcon(B)
  7464. };
  7465. B.removeEvents=function(){try{B.img.onload=null
  7466. }catch(C){}try{B.img.onerror=null
  7467. }catch(C){}};
  7468. B.fetchIcon=function(C){B.currUrl=C;
  7469. if(!B.blacklisted){B.img=new Image();
  7470. B.img.onload=B.handleLoad;
  7471. B.img.onerror=B.handleError;
  7472. B.img.src=C
  7473. }else{B.handleError()
  7474. }};
  7475. B.fetch=function(){B.fetchIcon(B.subUrl)
  7476. }
  7477. }else{Klib.error("Klib.FavIcon.icon(), Unable to properly parse url",A);
  7478. B.isValidUrl=false
  7479. }};
  7480. Klib.FavIcon.cached=function(A){var B=Klib.FavIcon.getUrl(A);
  7481. return Klib.FavIcon.cache.get(B)
  7482. };
  7483. Klib.FavIcon.updateCachedIcon=function(A){var B=Klib.FavIcon.getUrl(A.url);
  7484. Klib.FavIcon.cache.add(B,A);
  7485. if(A.exists&&Klib.Clue.currentEle){Klib.LinkScent.updateClueIcon(Klib.Clue.currentEle)
  7486. }};
  7487. Klib.FavIcon.updateFromDoc=function(H){if(H&&H.URL){var D=Klib.Url.parse(H.URL);
  7488. if(D.protocol=="https:"){Klib.FavIcon.cacheHttpsAllowed.add(D.domain,true)
  7489. }if(!Klib.FavIcon.getCurrFavIconUrl(H.URL)){var C=Klib.getEles("link",H);
  7490. for(var F=0;
  7491. F<C.length;
  7492. F++){var A=C[F].getAttribute("rel");
  7493. var B=C[F].href;
  7494. if(B&&A&&A.match(/icon/i)){var E=Klib.FavIcon.generateUrl(Klib.getFixedHref(C[F]),"full");
  7495. if(!Klib.FavIcon.cacheTestedUrls.exists(E)){var G=new Klib.FavIcon.icon(H.URL);
  7496. G.fetchIcon(E);
  7497. return 
  7498. }}}}}};
  7499. Klib.FavIcon.updateFromHtml=function(D,C){if(!Klib.FavIcon.getCurrFavIconUrl(C)){var A=D.match(/<link\b[^>]*\brel\b=[^>=]*\bicon\b[^>]*>/i);
  7500. if(A){var B=Klib.Html.getAttrValue(A[0],"href");
  7501. if(B){B=Klib.Url.realPath(B,Klib.Html.extractBaseHref(D,C));
  7502. var E=new Klib.FavIcon.icon(C);
  7503. E.fetchIcon(B)
  7504. }}}};
  7505. Klib.FavIcon.fetch=function(A,D){var C=Klib.FavIcon.getUrl(A);
  7506. if(!Klib.FavIcon.cached(A)){Klib.FavIcon.prefetchCache.add(C,true);
  7507. var B=new Klib.FavIcon.icon(A);
  7508. if(D){B.onComplete=D
  7509. }B.fetch()
  7510. }};
  7511. Klib.FavIcon.prefetch=function(A){if(Klib.isFirefox3){return Klib.FavIcon.prefetchFF3(A)
  7512. }else{if(A.match(/^http:/i)){var C=Klib.FavIcon.getUrl(A);
  7513. if(!Klib.FavIcon.cached(A)&&!Klib.FavIcon.prefetchCache.exists(C)){Klib.FavIcon.prefetchCache.add(C,true);
  7514. var B=new Klib.FavIcon.icon(A);
  7515. B.fetch();
  7516. return 1
  7517. }else{return 0
  7518. }}else{return 0
  7519. }}};
  7520. Klib.FavIcon.prefetchFF3=function(C){var B=0;
  7521. var A=Klib.Url.parse(C);
  7522. if(A&&(A.protocol=="http:"||A.protocol=="https:")){var D=A.protocol+"//www."+A.basedomain+"/favicon.ico";
  7523. if(!Klib.FavIcon.prefetchCache.exists(D)){Klib.FavIcon.prefetchCache.add(D,true);
  7524. if(Klib.FavIcon.requestIconFF3(D)){B++
  7525. }}if(A.basedomain!=A.domain){var D=A.protocol+"//"+A.domain+"/favicon.ico";
  7526. if(!Klib.FavIcon.prefetchCache.exists(D)){Klib.FavIcon.prefetchCache.add(D,true);
  7527. if(Klib.FavIcon.requestIconFF3(D)){B++
  7528. }}}}return B
  7529. };
  7530. Klib.FavIcon.requestIconFF3=function(D){var A=Klib.urlToURI(D);
  7531. var C=Components.classes["@mozilla.org/browser/favicon-service;1"].getService(Components.interfaces.nsIFaviconService);
  7532. if(!A){return false
  7533. }else{if(C.isFailedFavicon(A)){return false
  7534. }else{var B=Klib.urlToURI(A.prePath);
  7535. C.setAndLoadFaviconForPage(B,A,false);
  7536. return true
  7537. }}}
  7538. }Klib.md5JS=function(O){var K=0;
  7539. var U="";
  7540. var D=8;
  7541. function J(Y){return L(G(M(Y),Y.length*D))
  7542. }function H(Y){return R(G(M(Y),Y.length*D))
  7543. }function I(Y){return V(G(M(Y),Y.length*D))
  7544. }function S(Y,Z){return L(N(Y,Z))
  7545. }function F(Y,Z){return R(N(Y,Z))
  7546. }function W(Y,Z){return V(N(Y,Z))
  7547. }function X(){return J("abc")=="900150983cd24fb0d6963f7d28e17f72"
  7548. }function G(n,h){n[h>>5]|=128<<((h)%32);
  7549. n[(((h+64)>>>9)<<4)+14]=h;
  7550. var m=1732584193;
  7551. var l=-271733879;
  7552. var k=-1732584194;
  7553. var j=271733878;
  7554. for(var e=0;
  7555. e<n.length;
  7556. e+=16){var g=m;
  7557. var f=l;
  7558. var Z=k;
  7559. var Y=j;
  7560. m=B(m,l,k,j,n[e+0],7,-680876936);
  7561. j=B(j,m,l,k,n[e+1],12,-389564586);
  7562. k=B(k,j,m,l,n[e+2],17,606105819);
  7563. l=B(l,k,j,m,n[e+3],22,-1044525330);
  7564. m=B(m,l,k,j,n[e+4],7,-176418897);
  7565. j=B(j,m,l,k,n[e+5],12,1200080426);
  7566. k=B(k,j,m,l,n[e+6],17,-1473231341);
  7567. l=B(l,k,j,m,n[e+7],22,-45705983);
  7568. m=B(m,l,k,j,n[e+8],7,1770035416);
  7569. j=B(j,m,l,k,n[e+9],12,-1958414417);
  7570. k=B(k,j,m,l,n[e+10],17,-42063);
  7571. l=B(l,k,j,m,n[e+11],22,-1990404162);
  7572. m=B(m,l,k,j,n[e+12],7,1804603682);
  7573. j=B(j,m,l,k,n[e+13],12,-40341101);
  7574. k=B(k,j,m,l,n[e+14],17,-1502002290);
  7575. l=B(l,k,j,m,n[e+15],22,1236535329);
  7576. m=E(m,l,k,j,n[e+1],5,-165796510);
  7577. j=E(j,m,l,k,n[e+6],9,-1069501632);
  7578. k=E(k,j,m,l,n[e+11],14,643717713);
  7579. l=E(l,k,j,m,n[e+0],20,-373897302);
  7580. m=E(m,l,k,j,n[e+5],5,-701558691);
  7581. j=E(j,m,l,k,n[e+10],9,38016083);
  7582. k=E(k,j,m,l,n[e+15],14,-660478335);
  7583. l=E(l,k,j,m,n[e+4],20,-405537848);
  7584. m=E(m,l,k,j,n[e+9],5,568446438);
  7585. j=E(j,m,l,k,n[e+14],9,-1019803690);
  7586. k=E(k,j,m,l,n[e+3],14,-187363961);
  7587. l=E(l,k,j,m,n[e+8],20,1163531501);
  7588. m=E(m,l,k,j,n[e+13],5,-1444681467);
  7589. j=E(j,m,l,k,n[e+2],9,-51403784);
  7590. k=E(k,j,m,l,n[e+7],14,1735328473);
  7591. l=E(l,k,j,m,n[e+12],20,-1926607734);
  7592. m=Q(m,l,k,j,n[e+5],4,-378558);
  7593. j=Q(j,m,l,k,n[e+8],11,-2022574463);
  7594. k=Q(k,j,m,l,n[e+11],16,1839030562);
  7595. l=Q(l,k,j,m,n[e+14],23,-35309556);
  7596. m=Q(m,l,k,j,n[e+1],4,-1530992060);
  7597. j=Q(j,m,l,k,n[e+4],11,1272893353);
  7598. k=Q(k,j,m,l,n[e+7],16,-155497632);
  7599. l=Q(l,k,j,m,n[e+10],23,-1094730640);
  7600. m=Q(m,l,k,j,n[e+13],4,681279174);
  7601. j=Q(j,m,l,k,n[e+0],11,-358537222);
  7602. k=Q(k,j,m,l,n[e+3],16,-722521979);
  7603. l=Q(l,k,j,m,n[e+6],23,76029189);
  7604. m=Q(m,l,k,j,n[e+9],4,-640364487);
  7605. j=Q(j,m,l,k,n[e+12],11,-421815835);
  7606. k=Q(k,j,m,l,n[e+15],16,530742520);
  7607. l=Q(l,k,j,m,n[e+2],23,-995338651);
  7608. m=A(m,l,k,j,n[e+0],6,-198630844);
  7609. j=A(j,m,l,k,n[e+7],10,1126891415);
  7610. k=A(k,j,m,l,n[e+14],15,-1416354905);
  7611. l=A(l,k,j,m,n[e+5],21,-57434055);
  7612. m=A(m,l,k,j,n[e+12],6,1700485571);
  7613. j=A(j,m,l,k,n[e+3],10,-1894986606);
  7614. k=A(k,j,m,l,n[e+10],15,-1051523);
  7615. l=A(l,k,j,m,n[e+1],21,-2054922799);
  7616. m=A(m,l,k,j,n[e+8],6,1873313359);
  7617. j=A(j,m,l,k,n[e+15],10,-30611744);
  7618. k=A(k,j,m,l,n[e+6],15,-1560198380);
  7619. l=A(l,k,j,m,n[e+13],21,1309151649);
  7620. m=A(m,l,k,j,n[e+4],6,-145523070);
  7621. j=A(j,m,l,k,n[e+11],10,-1120210379);
  7622. k=A(k,j,m,l,n[e+2],15,718787259);
  7623. l=A(l,k,j,m,n[e+9],21,-343485551);
  7624. m=P(m,g);
  7625. l=P(l,f);
  7626. k=P(k,Z);
  7627. j=P(j,Y)
  7628. }return Array(m,l,k,j)
  7629. }function C(f,c,Z,Y,e,d){return P(T(P(P(c,f),P(Y,d)),e),Z)
  7630. }function B(e,Z,i,h,Y,g,f){return C((Z&i)|((~Z)&h),e,Z,Y,g,f)
  7631. }function E(e,Z,i,h,Y,g,f){return C((Z&h)|(i&(~h)),e,Z,Y,g,f)
  7632. }function Q(e,Z,i,h,Y,g,f){return C(Z^i^h,e,Z,Y,g,f)
  7633. }function A(e,Z,i,h,Y,g,f){return C(i^(Z|(~h)),e,Z,Y,g,f)
  7634. }function N(a,d){var c=M(a);
  7635. if(c.length>16){c=G(c,a.length*D)
  7636. }var Y=Array(16),b=Array(16);
  7637. for(var Z=0;
  7638. Z<16;
  7639. Z++){Y[Z]=c[Z]^909522486;
  7640. b[Z]=c[Z]^1549556828
  7641. }var e=G(Y.concat(M(d)),512+d.length*D);
  7642. return G(b.concat(e),512+128)
  7643. }function P(Y,b){var a=(Y&65535)+(b&65535);
  7644. var Z=(Y>>16)+(b>>16)+(a>>16);
  7645. return(Z<<16)|(a&65535)
  7646. }function T(Y,Z){return(Y<<Z)|(Y>>>(32-Z))
  7647. }function M(b){var a=Array();
  7648. var Y=(1<<D)-1;
  7649. for(var Z=0;
  7650. Z<b.length*D;
  7651. Z+=D){a[Z>>5]|=(b.charCodeAt(Z/D)&Y)<<(Z%32)
  7652. }return a
  7653. }function V(a){var b="";
  7654. var Y=(1<<D)-1;
  7655. for(var Z=0;
  7656. Z<a.length*32;
  7657. Z+=D){b+=String.fromCharCode((a[Z>>5]>>>(Z%32))&Y)
  7658. }return b
  7659. }function L(a){var Z=K?"0123456789ABCDEF":"0123456789abcdef";
  7660. var b="";
  7661. for(var Y=0;
  7662. Y<a.length*4;
  7663. Y++){b+=Z.charAt((a[Y>>2]>>((Y%4)*8+4))&15)+Z.charAt((a[Y>>2]>>((Y%4)*8))&15)
  7664. }return b
  7665. }function R(b){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  7666. var d="";
  7667. for(var Z=0;
  7668. Z<b.length*4;
  7669. Z+=3){var c=(((b[Z>>2]>>8*(Z%4))&255)<<16)|(((b[Z+1>>2]>>8*((Z+1)%4))&255)<<8)|((b[Z+2>>2]>>8*((Z+2)%4))&255);
  7670. for(var Y=0;
  7671. Y<4;
  7672. Y++){if(Z*8+Y*6>b.length*32){d+=U
  7673. }else{d+=a.charAt((c>>6*(3-Y))&63)
  7674. }}}return d
  7675. }return J(O)
  7676. };
  7677. Klib.md5=function(G){var I=null;
  7678. try{I=Components.classes["@mozilla.org/security/hash;1"].createInstance(Components.interfaces.nsICryptoHash)
  7679. }catch(E){Klib.error("Unable to create crypto hash object",E)
  7680. }if(I){var D=[];
  7681. var J=G.length;
  7682. for(var C=0;
  7683. C<J;
  7684. ++C){D.push(G.charCodeAt(C))
  7685. }I.init(Components.interfaces.nsICryptoHash.MD5);
  7686. I.update(D,D.length);
  7687. var B=I.finish(false);
  7688. var K=[];
  7689. J=B.length;
  7690. for(var C=0;
  7691. C<J;
  7692. ++C){var F=B.charCodeAt(C);
  7693. var H=F%16;
  7694. var A=F>>4;
  7695. K.push(String.fromCharCode(A+(A>9?87:48))+String.fromCharCode(H+(H>9?87:48)))
  7696. }return K.join("")
  7697. }else{return Klib.md5JS(G)
  7698. }};
  7699. if(Klib.install("Delicious",0.1)){Klib.Delicious.cache=new Klib.Cache.Obj("Delicious.cache");
  7700. Klib.Delicious.bookmarkLink=function(){var A=2000;
  7701. var F=Klib.ClueFrame.contentFrame.doc;
  7702. var C=F?Klib.getSelectedHtml(F):"";
  7703. var D=Klib.getFixedHref(Klib.Clue.currentClue.link);
  7704. var G=Klib.Clue.currentClue.getTitle();
  7705. var B="http://del.icio.us/post?v=4;noui=yes;jump=close;url="+encodeURIComponent(D)+";title="+encodeURIComponent(G)+";notes="+encodeURIComponent(C);
  7706. B=Klib.strTruncate(B,A);
  7707. var E=new Klib.KWindow("InterclueDelicious");
  7708. E.useChromeDialog=true;
  7709. E.open(B,700,400)
  7710. };
  7711. Klib.Delicious.receiveTags=function(D){var B="";
  7712. var C=false;
  7713. if(D.error){Klib.warning("Failed to retrieve tags for "+D.url,D.origUrl,D.status,D.statusText);
  7714. B=D.status+" : "+D.statusText
  7715. }else{if(!D.json){B=Klib.string("metadata.delicious.error.server.unavailable")
  7716. }else{if(D.json.length==0||(D.json[0]&&D.json[0].total_posts==0)){D.json[0]={url:D.origUrl,total_posts:0}
  7717. }else{C=true
  7718. }}}if(B){Klib.Delicious.cache.add(D.origUrl,{error:true,errorMsg:B})
  7719. }else{Klib.Delicious.cache.add(D.origUrl,D.json[0])
  7720. }var E=Klib.Clue.currentClue;
  7721. if(Klib.ClueFrame.visible&&E&&E.link&&(Klib.getFixedHref(E.link)==D.origUrl)&&Klib.ClueFrame.contentFrame){var A=$("metadata-delicious-content",Klib.ClueFrame.contentFrame.doc);
  7722. if(A){A.innerHTML=Klib.Delicious.htmlBlock(D.origUrl,true)
  7723. }var F=$("metadata-delicious-block",Klib.ClueFrame.contentFrame.doc);
  7724. if(!C&&F){Klib.addClass(F,"metadata-block-disabled")
  7725. }}};
  7726. Klib.Delicious.sortTags=function(B){function D(F,E){if(F.tagText<E.tagText){return -1
  7727. }else{if(F.tagText==E.tagText){return 0
  7728. }else{return 1
  7729. }}}var A=[];
  7730. for(var C in B){A.push({tagText:C,tagCount:B[C]})
  7731. }A.sort(D);
  7732. return A
  7733. };
  7734. Klib.Delicious.htmlTagList=function(K){var C='<table class="interclue-delicious-tags-list" cellpadding="0" cellspacing="0">';
  7735. C+='<colgroup>            <col class="col-text" />            <col class="col-int" />        </colgroup>';
  7736. var J="odd";
  7737. var G=Klib.Pref.get("Metadata.delicious.maxListItems");
  7738. var D=0;
  7739. var F=[];
  7740. for(var H in K){F.push({tag:H,cnt:parseInt(K[H])})
  7741. }F.sort(function(M,L){if(M.cnt!=L.cnt){return L.cnt-M.cnt
  7742. }else{return(M.tag.toLowerCase()>=L.tag.toLocaleString())?1:-1
  7743. }});
  7744. for(var B=0;
  7745. B<F.length;
  7746. B++){if(B>=G){break
  7747. }var I=F[B]["tag"];
  7748. var A=F[B]["cnt"];
  7749. var E='<a href="http://del.icio.us/popular/'+Klib.htmlspecialchars(I)+'" title="View popular delicious links tagged "'+Klib.htmlspecialchars(I)+'"">'+Klib.htmlspecialchars(I)+"</a>";
  7750. C+='<tr class="'+J+' textcell"><td class="interclue-delicious-tags-link">'+E+'</td><td class="interclue-delicious-tags-count intcell">'+Klib.htmlspecialchars(A)+"</td></tr>";
  7751. J=(J=="odd")?"even":"odd"
  7752. }C+="</table>";
  7753. return C
  7754. };
  7755. Klib.Delicious.htmlTagCloud=function(L){L=Klib.Delicious.sortTags(L);
  7756. var E=0;
  7757. var H=1000000;
  7758. for(var C=0;
  7759. C<L.length;
  7760. C++){var M=L[C];
  7761. if(M.tagCount<H){H=M.tagCount
  7762. }if(M.tagCount>E){E=M.tagCount
  7763. }}var B=Math.log(E)/Math.log(2000);
  7764. B=Klib.limit(B,0,1);
  7765. var I=0.85;
  7766. var K=1.8;
  7767. K=((K-I)*B)+I;
  7768. var A=K-I;
  7769. var D='<div class="interclue-delicious-tagcloud">';
  7770. for(var C=0;
  7771. C<L.length;
  7772. C++){var M=L[C];
  7773. var F=((M.tagCount/E)*A)+I;
  7774. var J="<h3>"+Klib.sprites.delicious.getHTML()+" Del.icio.us</h3><hr /><p>"+Klib.string("metadata.delicious.tagged",M.tagCount,M.tagText)+"</p>";
  7775. var G='<a class="interclue-delicious-tagcloud-term" style="font-size: '+F+'em" href="http://del.icio.us/tags/'+Klib.htmlspecialchars(M.tagText)+'" tooltip="'+Klib.htmlspecialchars(J)+'">'+Klib.htmlspecialchars(M.tagText)+"</a>";
  7776. D+=G+" "
  7777. }D+="</div>";
  7778. return D
  7779. };
  7780. Klib.Delicious.htmlBlock=function(B,A){B=Klib.Url.noHash(B);
  7781. B=Klib.Url.removeRedirect(B);
  7782. var C=Klib.Delicious.cache.get(B);
  7783. var F="Del.icio.us";
  7784. var E="";
  7785. var D="";
  7786. if(C&&(C=="retrieving")){E='<div id="metadata-delicious-loading">'+Klib.string("metadata.delicious.fetching.tag.cloud")+Klib.sprites.loading.getHTML()+"</div>"
  7787. }else{if(C){if(C.total_posts>0){F=Klib.string("metadata.delicious.postcount",C.total_posts);
  7788. if(Klib.Pref.get("Metadata.delicious.type")=="list"){E=Klib.Delicious.htmlTagList(C.top_tags)
  7789. }else{E=Klib.Delicious.htmlTagCloud(C.top_tags)
  7790. }}else{if(C.error){D='<img src="'+Klib.skinUrl()+'/dialogs/warning.png" /> '+C.errorMsg
  7791. }else{if(C.total_posts==0){D=Klib.string("metadata.delicious.error.no.records")
  7792. }}}}else{Klib.Delicious.fetchTags(B);
  7793. E='<div id="metadata-delicious-loading">'+Klib.string("metadata.delicious.fetching.tag.cloud")+Klib.sprites.loading.getHTML()+"</div>"
  7794. }}if(A){return E||D
  7795. }else{var G='<a id="delicious-add-link" href="javascript:;">{metadata.delicious.add}</a>';
  7796. return Klib.Content.getBlockHtml("delicious",F,E,D,"javascript:;","metadata-block-3rd-party",G)
  7797. }};
  7798. Klib.Delicious.fetchTags=function(A){if(Klib.platform=="IEToolbar"){return 
  7799. }if(A){A=Klib.Url.noHash(A);
  7800. A=Klib.Url.removeRedirect(A);
  7801. var B=Klib.Delicious.cache.get(A);
  7802. if(!B){Klib.Delicious.cache.add(A,"retrieving");
  7803. var E=Klib.md5(A);
  7804. var C="http://badges.del.icio.us/feeds/json/url/data?hash="+E;
  7805. var D=new Klib.Ajax.Obj(C);
  7806. D.isJson=true;
  7807. D.origUrl=A;
  7808. D.onComplete=Klib.Delicious.receiveTags;
  7809. D.send()
  7810. }else{}}else{Klib.error("Klib.Delicious.fetchTags() no url given")
  7811. }}
  7812. }Klib.Template=function(){var _this=this;
  7813. var undefined;
  7814. _this.format="HTML";
  7815. _this.template="";
  7816. _this.vars={};
  7817. _this.funcs={};
  7818. _this.blockFuncs={};
  7819. _this.add=function(name,obj){name=(name.substr(0,1)=="$")?name:("$"+name);
  7820. _this.vars[name]=obj
  7821. };
  7822. _this.addFunction=function(name,fn,encodesOutput){_this.funcs[name]=fn;
  7823. _this.funcs[name].encodesOutput=encodesOutput
  7824. };
  7825. _this.addBlockFunction=function(name,fn,encodesOutput){_this.blockFuncs[name]=fn;
  7826. _this.blockFuncs[name].encodesOutput=encodesOutput
  7827. };
  7828. _this.error=function(msg,err){Klib.error("Template",msg,err)
  7829. };
  7830. _this.textToHTML=function(str){var replacements=[["&","&"],['"',"""],["'","'"],["<","<"],[">",">"]];
  7831. var sections=str.split(/(&\w+;?|&#\d+;?)/);
  7832. for(var i=0;
  7833. i<sections.length;
  7834. i++){var section=sections[i];
  7835. if(section.match(/(&\w+;?|&#\d+;?)/)){if(!section.match(/;$/)){section+=";"
  7836. }}else{for(var j=0;
  7837. j<replacements.length;
  7838. j++){section=section.split(replacements[j][0]).join(replacements[j][1])
  7839. }}sections[i]=section
  7840. }return sections.join("")
  7841. };
  7842. _this.encodeOutput=function(str,format){switch(format){case"HTML":return _this.textToHTML(str);
  7843. default:_this.error("Unknown format ["+format+"]");
  7844. break
  7845. }return""
  7846. };
  7847. _this.isVar=function(varId,allowUndefined){if(allowUndefined){var regex=/^\$\w+$/;
  7848. return regex.test(varId)
  7849. }else{return(_this.vars[varId]!==undefined)
  7850. }};
  7851. _this.getVar=function(varId){if(_this.vars[varId]!==undefined){return _this.vars[varId]
  7852. }else{if(varId.indexOf(".")){var bits=varId.split(/\./g);
  7853. var numSections=bits.length;
  7854. var propId="";
  7855. for(var i=numSections-1;
  7856. i>=0;
  7857. i--){propId=propId?(propId+"."+bits.pop()):bits.pop();
  7858. varId=bits.join(".");
  7859. if(_this.vars[varId]!==undefined){return _this.vars[varId][propId]
  7860. }}}}return null
  7861. };
  7862. _this.render=function(template,format){format=format||_this.format;
  7863. template=template||_this.template;
  7864. var output=[];
  7865. while(template.length>0){var sections=template.match(/^([^\{]*)\{([^\}]*)\}([\w\W]*)$/m);
  7866. if(sections){output.push(sections[1]);
  7867. var section=sections[2];
  7868. var replacement="";
  7869. var outputEncoded=false;
  7870. template=sections[3];
  7871. if(/^(\$[\w]+)(.*)$/.test(section)){var matches=section.match(/^(\$[\w]+)(.*)$/);
  7872. var obj=_this.getVar(matches[1]);
  7873. if(obj!==null){var cmd="obj"+matches[2];
  7874. outputEncoded=false;
  7875. try{replacement=eval(cmd)
  7876. }catch(e){_this.error("Replacement threw an error whilst evaluating ["+section+"]",e)
  7877. }}else{_this.error("Object not found ["+matches[1]+"]")
  7878. }}else{if(/^\w+\((.*)\)$/.test(section)){var matches=section.match(/^(\w+)\((.*)\)$/);
  7879. if(_this.funcs[matches[1]]){var fn=_this.funcs[matches[1]];
  7880. outputEncoded=fn.encodesOutput;
  7881. var args=matches[2].split(/\s*\,\s*/g);
  7882. var cmdArgs=[];
  7883. for(var i=0;
  7884. i<args.length;
  7885. i++){if(args[i].indexOf("$")==0){if(_this.getVar(args[i])){args[i]=_this.getVar(args[i])
  7886. }else{_this.error("Variable doesn't exist ["+args[i]+"]")
  7887. }}cmdArgs.push("args["+i+"]")
  7888. }var cmd="fn("+cmdArgs.join(",")+")";
  7889. try{replacement+=eval(cmd)
  7890. }catch(e){_this.error("Function threw an error whilst evaluating ["+section+"]",e)
  7891. }}else{_this.error("Function not registered ["+matches[1]+"]")
  7892. }}else{if(/^\w+\s+/.test(section)){var matches=section.match(/^(\w+)(\s+)(.*)$/);
  7893. var blockName=matches[1];
  7894. if(_this.blockFuncs[blockName]){var fn=_this.blockFuncs[blockName];
  7895. outputEncoded=fn.encodesOutput;
  7896. var args=matches[3].split(/\s+/g);
  7897. var endBlock="{/"+blockName+"}";
  7898. var endPos=template.indexOf(endBlock);
  7899. if(endPos>-1){var block=template.substr(0,endPos);
  7900. replacement=fn(block,args);
  7901. template=template.substr(endPos+endBlock.length)
  7902. }else{_this.error("Cannot find end of block ["+blockName+"]")
  7903. }}else{_this.error("Block function not registered ["+blockName+"]")
  7904. }}else{_this.error("Invalid replacement in template ["+section+'] remember variables must start with a "$"')
  7905. }}}if(replacement){if(!outputEncoded){replacement=_this.encodeOutput(replacement,format)
  7906. }output.push(replacement)
  7907. }}else{output.push(template);
  7908. break
  7909. }}return output.join("")
  7910. };
  7911. _this.addFunction("upper",function(str){return str.toUpperCase()
  7912. });
  7913. _this.addFunction("lower",function(str){return str.toLowerCase()
  7914. });
  7915. _this.addFunction("capitalise",function(str){var words=str.match(/(\S+\s*)/g);
  7916. for(var i=0;
  7917. i<words.length;
  7918. i++){words[i]=words[i].substr(0,1).toUpperCase()+words[i].substr(1)
  7919. }return words.join("")
  7920. });
  7921. _this.addFunction("cycle",function(){_this.cycleCount=(_this.cycleCount===undefined)?0:(_this.cycleCount+1);
  7922. if(_this.cycleCount>=arguments.length){_this.cycleCount=0
  7923. }return arguments[_this.cycleCount]
  7924. });
  7925. _this.addBlockFunction("if",function(block,args){var code=args.join(" ");
  7926. var t=_this;
  7927. code=code.replace(/(\$[\w\-\_]+)/g,'t.getVar("$1")');
  7928. if(eval(code)){return _this.render(block,_this.format)
  7929. }else{return""
  7930. }},true);
  7931. _this.addBlockFunction("foreach",function(block,args){if((args.length==3)&&_this.isVar(args[0],true)&&(args[1]=="as")&&_this.isVar(args[2],true)){var arr=_this.getVar(args[0]);
  7932. if(arr&&arr.length!==undefined){var output="";
  7933. for(var i=0;
  7934. i<arr.length;
  7935. i++){_this.add(args[2],arr[i]);
  7936. output+=_this.render(block,_this.format)
  7937. }return output
  7938. }else{_this.error("Invalid foreach argument ["+args[0]+"] must be an array");
  7939. return""
  7940. }}else{_this.error("Syntax error {foreach $arr as $var} != ["+args+"]");
  7941. return""
  7942. }},true)
  7943. };
  7944. Klib.Template.quick=function(D,C){var B=new Klib.Template();
  7945. for(var A in C){B.add(A,C[A])
  7946. }return B.render(D)
  7947. };
  7948. if(Klib.install("Thumbnail",0.1)){Klib.Thumbnail.cache=new Klib.Cache.Obj("Thumbnails");
  7949. Klib.Thumbnail.Site=function(A){var B=this;
  7950. B.id=A.id;
  7951. B.name=A.name;
  7952. B.website=A.website;
  7953. B.generateUrl=A.generateUrl;
  7954. B.validateImage=A.validateImage;
  7955. B.spriteName=A.spriteName||"";
  7956. B.getAttribution=function(D){var C='<div id="interclue-thumbnail-attribution">';
  7957. if(D){C+='<a href="'+B.website+'"><img src="'+Klib.baseUrl+"/thumbnails/"+B.id+'.png" /></a>'
  7958. }C+='<p>Thumbnails provided by <a href="'+B.website+'">'+B.name+"</a>.</p>";
  7959. C+="</div>";
  7960. return C
  7961. };
  7962. B.onImageComplete=function(C){if(B.validateImage(C)){C.providerName=B.name;
  7963. C.providerAttribution=B.getAttribution(true);
  7964. C.providerId=B.id
  7965. }else{C.state="error"
  7966. }B.kImg=C
  7967. };
  7968. B.getImg=function(D,C){C=(C===undefined)?true:C;
  7969. var E=Klib.Url.parse(D);
  7970. var G=B.generateUrl(E);
  7971. if(G){var F=Klib.Thumbnail.cache.get(G);
  7972. if(!F||!C){F=new Klib.KImage(G);
  7973. Klib.Thumbnail.cache.add(G,F)
  7974. }return F
  7975. }else{Klib.error("Thumbnail.Site: Unable to generate thumbnail url",B.id,E);
  7976. return null
  7977. }};
  7978. B.retrieve=function(C,F){var D=Klib.Url.parse(C);
  7979. var E=B.generateUrl(D);
  7980. if(E){var G=Klib.Thumbnail.cache.get(E);
  7981. if(!G){G=new Klib.KImage(E);
  7982. Klib.Thumbnail.cache.add(E,G)
  7983. }switch(G.state){case"success":return G;
  7984. case"error":return false;
  7985. case"fetching":return"fetching";
  7986. case"init":G.onComplete=B.onImageComplete;
  7987. G.fetch();
  7988. return"fetching";
  7989. default:Klib.error("Invalid thumbnail.state",G.state);
  7990. break
  7991. }}else{Klib.error("Thumbnail.Site: Unable to generate thumbnail url",B.id,D)
  7992. }return false
  7993. }
  7994. };
  7995. Klib.Thumbnail.getImg=function(B){var A=Klib.Thumbnail.sites[Klib.Pref.get("Thumbnails.providerId","")];
  7996. if(!A){A=Klib.Thumbnail.sites.thumbshots
  7997. }return A.getImg(B)
  7998. };
  7999. Klib.Thumbnail.provider=function(){var A=Klib.Thumbnail.sites[Klib.Pref.get("Thumbnails.providerId","thumbshots")];
  8000. if(!A){A=Klib.Thumbnail.sites.thumbshots
  8001. }return A
  8002. };
  8003. Klib.Thumbnail.getSite=function(A){return Klib.Thumbnail.sites[A]?Klib.Thumbnail.sites[A]:false
  8004. };
  8005. Klib.Thumbnail.sites={};
  8006. Klib.Thumbnail.addSite=function(A){Klib.Thumbnail.sites[A.id]=new Klib.Thumbnail.Site(A)
  8007. };
  8008. Klib.Thumbnail.addSite({id:"thumbshots",name:"Thumbshots.org",website:"http://www.thumbshots.org/",spriteName:"thumbshots",generateUrl:function(A){return"http://open.thumbshots.org/image.pxf?url=http://"+A.domain
  8009. },validateImage:function(A){return(A.width>90)
  8010. }});
  8011. Klib.Thumbnail.addSite({id:"thumbshots.de",name:"Thumbshots.de",website:"http://www.thumbshots.de/",generateUrl:function(A){return"http://www.thumbshots.de/cgi-bin/show.cgi?url=http://"+A.domain
  8012. },validateImage:function(A){return(A.width>50)
  8013. }});
  8014. Klib.Thumbnail.addSite({id:"websnapr",name:"websnapr 2.0",website:"http://www.websnapr.com/",generateUrl:function(A){return"http://images.websnapr.com/?url="+A.domain+"&size=s"
  8015. },validateImage:function(A){return(A.width>50)
  8016. }});
  8017. Klib.Thumbnail.addSite({id:"websitethumbnails.net",name:"websitethumbnails",website:"http://www.websitethumbnails.net/",generateUrl:function(A){return"http://www.websitethumbnails.net/thumbnails/"+A.domain+".png"
  8018. },validateImage:function(A){return A.exists
  8019. }})
  8020. }if(Klib.install("Changelog",0.1)){Klib.Changelog.win=null;
  8021. Klib.Changelog.show=function(){var A=Klib.baseUrl+"/changelog/changelog.html";
  8022. Klib.ClueBridge.openUrl(A,true,true)
  8023. };
  8024. Klib.Changelog.handleUpdate=function(){if(Klib.Pref.get("Changelog.showOnUpdate")){Klib.Changelog.show()
  8025. }};
  8026. Klib.GEvent.addEvent("update",Klib.Changelog.handleUpdate)
  8027. }if(Klib.install("Stats",0.1)){Klib.Stats.cachePages=new Klib.Cache.Obj("Stats.cachePages");
  8028. Klib.Stats.cacheClues=new Klib.Cache.Obj("Stats.cacheClues");
  8029. Klib.Stats.Obj=function(){var A=this;
  8030. A.datestamp=Klib.datestamp();
  8031. A.totalViewsPages=0;
  8032. A.totalTimePages=0;
  8033. A.totalViewsClues=0;
  8034. A.totalTimeClues=0;
  8035. A.totalClickThroughs=0;
  8036. A.load=function(){if(Klib.Global.get("cluestats.datestamp","")==A.datestamp){A.totalViewsPages=Klib.Global.get("cluestats.totalViewsPages",0);
  8037. A.totalTimePages=Klib.Global.get("cluestats.totalTimePages",0);
  8038. A.totalViewsClues=Klib.Global.get("cluestats.totalViewsClues",0);
  8039. A.totalTimeClues=Klib.Global.get("cluestats.totalTimeClues",0);
  8040. A.totalClickThroughs=Klib.Global.get("cluestats.totalClickThroughs",0)
  8041. }else{var B=Klib.Pref.get("cluestats");
  8042. B=B||{};
  8043. if(B[A.datestamp]){A.totalViewsPages=B[A.datestamp].totalViewsPages;
  8044. A.totalTimePages=B[A.datestamp].totalTimePages;
  8045. A.totalViewsClues=B[A.datestamp].totalViewsClues;
  8046. A.totalTimeClues=B[A.datestamp].totalTimeClues;
  8047. A.totalClickThroughs=B[A.datestamp].totalClickThroughs
  8048. }}};
  8049. A.save=function(){var B=Klib.Pref.get("cluestats",{});
  8050. B=B||{};
  8051. B[A.datestamp]=B[A.datestamp]||{};
  8052. B[A.datestamp].totalViewsPages=A.totalViewsPages;
  8053. B[A.datestamp].totalTimePages=A.totalTimePages;
  8054. B[A.datestamp].totalViewsClues=A.totalViewsClues;
  8055. B[A.datestamp].totalTimeClues=A.totalTimeClues;
  8056. B[A.datestamp].totalClickThroughs=A.totalClickThroughs;
  8057. Klib.Pref.set("cluestats",B)
  8058. }
  8059. };
  8060. Klib.Stats.init=function(){var A=new Klib.Stats.Obj();
  8061. A.load();
  8062. if(Klib.Global.get("cluestats.datestamp",false)===false){Klib.Global.set("cluestats.datestamp",A.datestamp);
  8063. Klib.Global.set("cluestats.totalViewsPages",A.totalViewsPages);
  8064. Klib.Global.set("cluestats.totalTimePages",A.totalTimePages);
  8065. Klib.Global.set("cluestats.totalViewsClues",A.totalViewsClues);
  8066. Klib.Global.set("cluestats.totalTimeClues",A.totalTimeClues);
  8067. Klib.Global.set("cluestats.totalClickThroughs",A.totalClickThroughs)
  8068. }Klib.addEvent(window,"beforeunload",Klib.Stats.save);
  8069. Klib.Stats.update()
  8070. };
  8071. Klib.Stats.save=function(){var A=new Klib.Stats.Obj();
  8072. A.load();
  8073. A.save()
  8074. };
  8075. Klib.Stats.viewClue=function(B){var A=Klib.getFixedHref(B.link);
  8076. if(A&&!Klib.Stats.cacheClues.exists(A)){Klib.Stats.cacheClues.add(A,true);
  8077. Klib.Global.inc("cluestats.totalViewsClues");
  8078. Klib.Stats.update()
  8079. }};
  8080. Klib.Stats.viewPage=function(B){var A=B.URL;
  8081. if(!A){return 
  8082. }if(Klib.Stats.cacheClues.exists(A)){Klib.Global.inc("cluestats.totalClickThroughs")
  8083. }if(!Klib.Stats.cachePages.exists(A)){Klib.Stats.cachePages.add(A,true);
  8084. Klib.Global.inc("cluestats.totalViewsPages")
  8085. }};
  8086. Klib.Stats.start=function(){Klib.setInterval("clueStatsTick",Klib.Stats.tick,1000)
  8087. };
  8088. Klib.Stats.setActive=function(){Klib.Stats.userActive=true;
  8089. Klib.setNamedTimer("clueStatsActive",Klib.Stats.timerActive,Klib.Pref.get("User.activeTimeout",5)*1000)
  8090. };
  8091. Klib.Stats.tickCount=0;
  8092. Klib.Stats.cleanUp=function(){Klib.clearTimer("clueStatsTick");
  8093. Klib.Stats.save()
  8094. };
  8095. Klib.Stats.tick=function(){if(!Klib.User.winLoggedIn){return 
  8096. }Klib.Stats.tickCount++;
  8097. if(Klib.Stats.tickCount>60){Klib.Stats.save();
  8098. Klib.Stats.tickCount=0
  8099. }if((Klib.Stats.lastScreenX!=Klib.Mouse.screenX)||(Klib.Stats.lastScreenY!=Klib.Mouse.screenY)){Klib.Stats.setActive()
  8100. }Klib.Stats.lastScreenX=Klib.Mouse.screenX;
  8101. Klib.Stats.lastScreenY=Klib.Mouse.screenY;
  8102. if(Klib.Stats.userActive){if(Klib.ClueFrame.visible){Klib.Global.inc("cluestats.totalTimeClues")
  8103. }else{Klib.Global.inc("cluestats.totalTimePages")
  8104. }}var A=Klib.datestamp();
  8105. var C=Klib.Global.get("cluestats.datestamp","");
  8106. if(C!=A){Klib.Global.set("cluestats.datestamp",A);
  8107. var B=new Klib.Stats.Obj();
  8108. B.datestamp=C;
  8109. B.load();
  8110. B.save();
  8111. Klib.Global.set("cluestats.totalViewsPages",0);
  8112. Klib.Global.set("cluestats.totalTimePages",0);
  8113. Klib.Global.set("cluestats.totalViewsClues",0);
  8114. Klib.Global.set("cluestats.totalTimeClues",0);
  8115. Klib.Global.set("cluestats.totalClickThroughs",0);
  8116. Klib.Stats.update()
  8117. }};
  8118. Klib.Stats.lastScreenX=0;
  8119. Klib.Stats.lastScreenY=0;
  8120. Klib.Stats.userActive=false;
  8121. Klib.Stats.timerActive=function(){Klib.Stats.userActive=false;
  8122. Klib.Stats.update()
  8123. };
  8124. Klib.Stats.update=function(){};
  8125. Klib.Stats.clearAllStats=function(){Klib.Pref.set("cluestats",{});
  8126. Klib.Stats.cachePages.empty();
  8127. Klib.Stats.cacheClues.empty();
  8128. Klib.Global.set("cluestats.datestamp",Klib.datestamp());
  8129. Klib.Global.set("cluestats.totalViewsPages",0);
  8130. Klib.Global.set("cluestats.totalTimePages",0);
  8131. Klib.Global.set("cluestats.totalViewsClues",0);
  8132. Klib.Global.set("cluestats.totalTimeClues",0);
  8133. Klib.Global.set("cluestats.totalClickThroughs",0);
  8134. if(Klib.Windows.InterclueUserPreferences&&Klib.Windows.InterclueUserPreferences.win){var A=Klib.Windows.InterclueUserPreferences.win.document;
  8135. if(A){$("interclue-preferencesdialog-cluestats",A).innerHTML=Klib.Stats.getHTML(true)
  8136. }}};
  8137. Klib.Stats.getDailyStat=function(A){return Klib.Global.get("cluestats."+A,0)
  8138. };
  8139. Klib.Stats.getStat=function(E,H,G){H=H||0;
  8140. G=G||Klib.daysSinceEpoch();
  8141. var D=Klib.Pref.get("cluestats",{});
  8142. var C=Klib.daysSinceEpoch();
  8143. var F=0;
  8144. for(var A in D){var B=Klib.daysSinceEpoch(new Date(A));
  8145. if(B>=H&&B<G){F+=D[A][E]
  8146. }}if(G>=C){F+=Klib.Global.get("cluestats."+E,0)
  8147. }return F
  8148. };
  8149. Klib.Stats.getNumOfDaysUsed=function(){var B=Klib.Pref.get("cluestats",{});
  8150. var C=0;
  8151. for(var A in B){C++
  8152. }return C
  8153. };
  8154. Klib.Stats.quickStats=function(){return"tvp_"+Klib.Stats.getStat("totalViewsPages")+"_tvc_"+Klib.Stats.getStat("totalViewsClues")+"_ttp_"+Klib.Stats.getStat("totalTimePages")+"_ttc_"+Klib.Stats.getStat("totalTimeClues")
  8155. };
  8156. Klib.Stats.calcROI=function(K){if(K.isEvent){K=Klib.getDoc(K.source)
  8157. }if(!$("interclue-preferencesdialog-roi-income",K)){return 
  8158. }var B=Klib.Stats.getStat("totalTimePages")/Klib.Stats.getStat("totalViewsPages");
  8159. var A=Klib.Stats.getStat("totalTimeClues")/Klib.Stats.getStat("totalViewsClues");
  8160. var C=Klib.Stats.getStat("totalViewsClues")-Klib.Stats.getStat("totalClickThroughs");
  8161. var I=(C*(B-A));
  8162. var G=parseInt($("interclue-preferencesdialog-roi-income",K).value);
  8163. var F=G*(I/3600);
  8164. var D=Klib.Stats.getNumOfDaysUsed();
  8165. var J=(F/D);
  8166. var H=(I/D);
  8167. if(F&&F!=Number.POSITIVE_INFINITY){var E="Interclue has saved me <strong>${totalMoneySaved}</strong> ({totalHoursSaved} hours) in the last {totalDaysUsed} days,<br />            or an average of <strong>${avgMoneyPerYear}</strong> ({avgHoursPerYear} hours) per year.";
  8168. E=E.replace("{totalMoneySaved}",Klib.round(F,2,true));
  8169. E=E.replace("{totalHoursSaved}",Klib.formatTime(I,"h:m"));
  8170. E=E.replace("{totalDaysUsed}",D);
  8171. E=E.replace("{avgMoneyPerYear}",Klib.round((J*365),2,true));
  8172. E=E.replace("{avgHoursPerYear}",Klib.formatTime((H*365),"h:m"));
  8173. $("interclue-preferencesdialog-roi-saving",K).innerHTML=E
  8174. }};
  8175. Klib.Stats.avgMoneySavedPerDay=function(){var F=Klib.Stats.getStat("totalTimePages")/Klib.Stats.getStat("totalViewsPages");
  8176. var G=Klib.Stats.getStat("totalTimeClues")/Klib.Stats.getStat("totalViewsClues");
  8177. var B=Klib.Stats.getStat("totalViewsClues")-Klib.Stats.getStat("totalClickThroughs");
  8178. var A=(B*(F-G));
  8179. var E=Klib.Pref.get("User.stats.incomePerHour",20)*(A/3600);
  8180. var C=Klib.Stats.getNumOfDaysUsed();
  8181. var D=(E/C);
  8182. if(D&&D!=Number.POSITIVE_INFINITY){return D
  8183. }else{return 0
  8184. }};
  8185. Klib.Stats.getHTML=function(){var Q=Klib.Pref.get("cluestats",{});
  8186. var P=Klib.daysSinceEpoch();
  8187. var K={today:{datestamp:P,totalViewsPages:0,totalViewsClues:0,totalTimePages:0,totalTimeClues:0,totalClickThroughs:0},yesterday:{datestamp:P-1,totalViewsPages:0,totalViewsClues:0,totalTimePages:0,totalTimeClues:0,totalClickThroughs:0},lastWeek:{datestamp:P-7,totalViewsPages:0,totalViewsClues:0,totalTimePages:0,totalTimeClues:0,totalClickThroughs:0},lastMonth:{datestamp:P-30,totalViewsPages:0,totalViewsClues:0,totalTimePages:0,totalTimeClues:0,totalClickThroughs:0},lastYear:{datestamp:P-365,totalViewsPages:0,totalViewsClues:0,totalTimePages:0,totalTimeClues:0,totalClickThroughs:0}};
  8188. var C=0;
  8189. var E=0;
  8190. var L=0;
  8191. var J=0;
  8192. var R=0;
  8193. var O=0;
  8194. for(var S in Q){var N=Klib.daysSinceEpoch(new Date(S));
  8195. C+=1;
  8196. E+=Q[S].totalViewsPages;
  8197. L+=Q[S].totalViewsClues;
  8198. J+=Q[S].totalTimePages;
  8199. R+=Q[S].totalTimeClues;
  8200. O+=Q[S].totalClickThroughs;
  8201. for(var F in K){if(F=="total"){K.totals.totalViewsPages+=Q[S].totalViewsPages;
  8202. K.totals.totalViewsClues+=Q[S].totalViewsClues;
  8203. K.totals.totalTimePages+=Q[S].totalTimePages;
  8204. K.totals.totalTimeClues+=Q[S].totalTimeClues;
  8205. K.totals.totalClickThroughs+=Q[S].totalClickThroughs
  8206. }else{if(F=="yesterday"){if(N==(P-1)){K.yesterday.totalViewsPages+=Q[S].totalViewsPages;
  8207. K.yesterday.totalViewsClues+=Q[S].totalViewsClues;
  8208. K.yesterday.totalTimePages+=Q[S].totalTimePages;
  8209. K.yesterday.totalTimeClues+=Q[S].totalTimeClues;
  8210. K.yesterday.totalClickThroughs+=Q[S].totalClickThroughs
  8211. }}else{if(N>=K[F].datestamp){K[F].totalViewsPages+=Q[S].totalViewsPages;
  8212. K[F].totalViewsClues+=Q[S].totalViewsClues;
  8213. K[F].totalTimePages+=Q[S].totalTimePages;
  8214. K[F].totalTimeClues+=Q[S].totalTimeClues;
  8215. K[F].totalClickThroughs+=Q[S].totalClickThroughs
  8216. }}}}}var B={totalViewsPages:E/C,totalViewsClues:L/C,totalTimePages:J/C,totalTimeClues:R/C,totalClickThroughs:O/C};
  8217. if(C<7){K.lastWeek=Klib.Stats.getHTML.estimate(B,7)
  8218. }if(C<30){K.lastMonth=Klib.Stats.getHTML.estimate(B,30)
  8219. }if(C<365){K.lastYear=Klib.Stats.getHTML.estimate(B,365)
  8220. }var H='<table class="interclue-cluestats datatable" cellspacing="0" cellpadding="0" ><thead><tr><th> </th><th>{stats.title.today}</th><th>{stats.title.yesterday}</th><th>'+((C<7)?"{stats.title.7.day.estimate}":"{stats.title.last.7.days}")+"</th><th>"+((C<30)?"{stats.title.30.day.estimate}":"{stats.title.last.30.days}")+"</th><th>"+((C<365)?"{stats.title.365.day.estimate}":"{stats.title.last.365.days}")+"</th></th></tr></thead>";
  8221. H+='<tbody><tr class="odd"><th class="table-side-heading">{stats.title.total.pages.viewed}</th>';
  8222. for(var F in K){H+="<td>"+(K[F].totalViewsPages||"-")+"</td>"
  8223. }H+="</tr>";
  8224. H+='<tr class="even"><th class="table-side-heading">{stats.title.total.pages.time}</th>';
  8225. for(var F in K){H+="<td>"+Klib.formatTime(K[F].totalTimePages)+"</td>"
  8226. }H+="</tr>";
  8227. H+='<tr class="odd"><th class="table-side-heading">{stats.title.average.page.time}</th>';
  8228. for(var F in K){H+="<td>"+Klib.formatTime(K[F].totalTimePages/K[F].totalViewsPages)+"</td>"
  8229. }H+="</tr>";
  8230. H+='<tr class="even"><th class="table-side-heading">{stats.title.total.clues.viewed}</th>';
  8231. for(var F in K){H+="<td>"+(K[F].totalViewsClues||"-")+"</td>"
  8232. }H+="</tr>";
  8233. H+='<tr class="odd"><th class="table-side-heading">{stats.title.total.clues.time}</th>';
  8234. for(var F in K){H+="<td>"+Klib.formatTime(K[F].totalTimeClues)+"</td>"
  8235. }H+="</tr>";
  8236. H+='<tr class="even"><th class="table-side-heading">{stats.title.average.clue.time}</th>';
  8237. for(var F in K){H+="<td>"+Klib.formatTime(K[F].totalTimeClues/K[F].totalViewsClues)+"</td>"
  8238. }H+="</tr>";
  8239. H+='<tr class="odd"><th class="table-side-heading">{stats.title.total.clickthroughs}</th>';
  8240. for(var F in K){H+="<td>"+(K[F].totalClickThroughs||"-")+"</td>"
  8241. }H+="</tr>";
  8242. H+='<tr class="even"><th class="table-side-heading">{stats.title.roi}</th>';
  8243. for(var F in K){var I=(K[F].totalTimePages/K[F].totalViewsPages);
  8244. var G=(K[F].totalTimeClues/K[F].totalViewsClues);
  8245. var D=(I-G);
  8246. if(D<0){D=0
  8247. }var A=(K[F].totalViewsClues-K[F].totalClickThroughs);
  8248. var M=(A*D);
  8249. if(M<0){M=0
  8250. }H+="<td>"+Klib.formatTime(M)+"</td>"
  8251. }H+="</tr>";
  8252. H+="</tbody>";
  8253. if(C<365){H+='<tfoot><tr><td colspan="6">* {stats.estimated.explanation}</td></tr></tfoot>'
  8254. }H+="</table>";
  8255. return Klib.translate(H)
  8256. };
  8257. Klib.Stats.getHTML.estimate=function(B,A){var C={};
  8258. for(key in B){if(isNaN(B[key])){C[key]=B[key]
  8259. }else{C[key]=Math.floor(B[key]*A)
  8260. }}C.isEstimate=true;
  8261. return C
  8262. };
  8263. Klib.Stats.saveIncome=function(B){var A=B.source;
  8264. var C=parseInt(A.value);
  8265. if(C&&(C>0)&&(C<Number.POSITIVE_INFINITY)){Klib.Pref.set("User.stats.incomePerHour",C)
  8266. }};
  8267. Klib.Stats.openStatsWindow=function(){top.window.open("chrome://interclue/content/cluecore/stats/stats.xul","InterclueStatsDialog","resizable=yes,chrome=yes,dependent=yes,centerscreen=yes")
  8268. }
  8269. }if(Klib.install("Content",0.1)){Klib.Content.summaryImageShowFullSize=function(B){var D=Klib.isEle(B)?B:B.source;
  8270. var C=Klib.Url.parse(D.src,"filename");
  8271. Klib.ClueFrame.alert('<div align="center"><img id="summary-view-image-full-sized" src="'+D.src+'" /></div><div align="center">'+Klib.string("clueframe.alert.click.to.close")+"</div>",C,"message",0,null,null,"");
  8272. var E=$("summary-view-image-full-sized",Klib.ClueFrame.doc);
  8273. var A=Klib.getRect(E);
  8274. Klib.ClueFrame.alert.origSize=Klib.ClueFrame.resizeToContent(true,A.width+(A.left*2),A.height)
  8275. };
  8276. Klib.Content.summaryImageShowThumbnail=function(A,F,E,C){var B=C||{};
  8277. B.src=A.getAttribute("_src");
  8278. B.width=F||null;
  8279. B.height=E||null;
  8280. B["class"]=B["class"]||"";
  8281. B=Klib.Image.resizeDimentions(B,Klib.Pref.get("Summary.images.thumbnail.maxWidth"),Klib.Pref.get("Summary.images.thumbnail.maxHeight"));
  8282. var D=A.title?A.title:(A.alt?A.alt:"");
  8283. if(B.width!=F){B["class"]+=" summary-image-thumbnail";
  8284. B.title=D?D:("Click to view full sized ("+F+" x "+E+") image");
  8285. Klib.addEvent(A,"click",Klib.Content.summaryImageShowFullSize)
  8286. }else{B["class"]+=" summary-image";
  8287. B.title=D
  8288. }Klib.addEvent(A,"error",function(){Klib.setStyle(A,"display","none")
  8289. });
  8290. Klib.setAttrs(A,B);
  8291. Klib.setStyle(A,"backgroundImage","none");
  8292. Klib.setStyle(A,"display","inline");
  8293. Klib.setStyle(A,"visibility","visible")
  8294. };
  8295. Klib.Content.summaryImageCheckImage=function(A){if(A&&A.exists){if((A.width>=Klib.Pref.get("Summary.images.minWidth"))&&(A.height>=Klib.Pref.get("Summary.images.minHeight"))){Klib.Content.summaryImageShowThumbnail(A.origEle,A.width,A.height)
  8296. }}};
  8297. Klib.Content.enableImagesInSummaries=function(L,I){var G=Klib.getEles("img",L);
  8298. var D={};
  8299. var N=Klib.Pref.get("Summary.images.externalImageWhitelist").split(/\s+/);
  8300. for(var E=0;
  8301. E<G.length;
  8302. E++){var F=G[E];
  8303. var A=F.getAttribute("_src");
  8304. var B=F.getAttribute("_width")||0;
  8305. var M=F.getAttribute("_height")||0;
  8306. if(F&&A&&!F.checkedForSummaryImage){F.checkedForSummaryImage=true;
  8307. Klib.setStyle(F,"display","none");
  8308. var C=Klib.Url.parse(A,"basedomain");
  8309. var J=Klib.Url.parse(Klib.getFixedHref(I.link),"basedomain");
  8310. if(I.showFullContent){Klib.Content.summaryImageShowThumbnail(F,B,M,{"class":"clue-show-all-images"})
  8311. }else{if(!Klib.Pref.get("Summary.images.internalOnly")||(C==J)||Klib.inArray(C,N)){if(!B||!M){var H=new Klib.KImage(A);
  8312. H.origEle=F;
  8313. H.onComplete=Klib.Content.summaryImageCheckImage;
  8314. H.fetch()
  8315. }else{if(B>=Klib.Pref.get("Summary.images.minWidth")&&M>=Klib.Pref.get("Summary.images.minHeight")){Klib.Content.summaryImageShowThumbnail(F,B,M,{"class":"summary-image-known-size"})
  8316. }else{Klib.setStyle(F,"display","none")
  8317. }}}else{}}}var K=Klib.getParent(F,"a");
  8318. if(K&&K.getAttribute("href")){K.removeAttribute("href")
  8319. }}};
  8320. Klib.Content.initDoc=function(F,E){var G=("metadata-delicious-block",F);
  8321. if(G){var A=$("metadata-delicious-content",F);
  8322. if(A&&E&&E.link&&E.link.href&&$("metadata-delicious-loading",F)){A.innerHTML=Klib.Delicious.htmlBlock(Klib.getFixedHref(E.link),true)
  8323. }var D=$("delicious-add-link",F);
  8324. if(D){Klib.addEvent(D,"click",Klib.Delicious.bookmarkLink)
  8325. }var D=$("metadata-delicious-title-link",F);
  8326. if(D){Klib.addEvent(D,"click",Klib.Delicious.bookmarkLink)
  8327. }}Klib.Content.thumbnailUpdateContent();
  8328. var B=$("metadata-downloadablefiles-more-link",F);
  8329. var H=$("metadata-downloadablefiles-more-block",F);
  8330. var C=$("metadata-downloadablefiles-more-link-row",F);
  8331. if(B){Klib.addEvent(B,"click",function(){H.style.display="";
  8332. C.style.display="none"
  8333. })
  8334. }};
  8335. Klib.Content.microsummary=function(A){if(A.htmldoc.microsummaryFetched){return Klib.Content.getBlockHtml("microsummary",Klib.string("metadata.microsummary.title"),A.htmldoc.microsummaryText,Klib.string("metadata.microsummary.none"))
  8336. }else{if(A.htmldoc.microsummaryFetching){A.htmldoc.addEvent("receiveMicrosummary",Klib.Content.refreshMicrosummary);
  8337. Klib.setNamedTimer("Klib.Content.refreshMicrosummary",function(){Klib.Content.refreshMicrosummary(A.htmldoc)
  8338. },5000);
  8339. return Klib.Content.getBlockHtml("microsummary",Klib.string("metadata.microsummary.title"),"",Klib.string("metadata.microsummary.fetching"))
  8340. }else{return Klib.Content.getBlockHtml("microsummary",Klib.string("metadata.microsummary.title"),"",Klib.string("metadata.microsummary.none"))
  8341. }}};
  8342. Klib.Content.refreshMicrosummary=function(A){Klib.clearTimer("Klib.Content.refreshMicrosummary");
  8343. var B=$("metadata-microsummary-content",Klib.ClueFrame.contentFrame.doc);
  8344. if(B&&(A.url==Klib.ClueFrame.getCurrentURL())){B.innerHTML=A.microsummaryText?Klib.htmlspecialchars(A.microsummaryText):Klib.string("metadata.microsummary.xmltransformation")
  8345. }else{Klib.warning("Klib.Content.refreshMicrosummary: htmldoc.url != iframe.currentURL",A.url)
  8346. }};
  8347. Klib.Content.downloadableFiles=function(I){var N={};
  8348. var P=I.htmldoc.links;
  8349. P=Klib.arrayReduce(P);
  8350. var F=Klib.LinkScent.fileTypes;
  8351. var M=0;
  8352. for(var E=0;
  8353. E<P.length;
  8354. E++){var A=P[E];
  8355. var H=Klib.Url.parse(A);
  8356. if(H&&H.extension){var B=H.extension;
  8357. if(F[B]&&F[B]!="image"){var K=F[B];
  8358. N[K]=N[K]||[];
  8359. N[K].push(H);
  8360. M++
  8361. }}}var G="";
  8362. if(M>0){G='<table class="interclue-metadata-table interclue-open-link-in-clueframe" id="metadata-downloadablefiles-list" cellpadding="0" cellspacing="0">';
  8363. G+="<tbody>";
  8364. var O=0;
  8365. var J=Klib.Pref.get("Metadata.downloadableFiles.maxFilesToShow");
  8366. for(var K in N){var L=Klib.Clue.getClue(K);
  8367. for(var E=0;
  8368. E<N[K].length;
  8369. E++){var H=N[K][E];
  8370. G+='<tr class="'+((E%2==0)?"even":"odd")+'">';
  8371. var D=(L.description||L.name||L.id);
  8372. var C=L.iconHTML({"class":"interclue-content-linktype-image",title:D});
  8373. G+="<td>"+C+"</td>";
  8374. G+='<td><a href="'+H.url+'">'+Klib.strTruncate(H.filename,40)+"</a></td>";
  8375. G+="<td>"+H.extension+"</td>";
  8376. G+="</tr>";
  8377. O++;
  8378. if((O==J)&&(M>J)){G+='<tr id="metadata-downloadablefiles-more-link-row"><td></td><td colspan="2"><a id="metadata-downloadablefiles-more-link" href="javascript:;">+'+(M-J)+" {more}...</a></td></tr>";
  8379. G+="</tbody>";
  8380. G+='<tbody id="metadata-downloadablefiles-more-block" style="display: none">'
  8381. }}}G+="</tbody></table>";
  8382. return Klib.Content.getBlockHtml("downloadableFiles","{metadata.downloadablefiles.title} ("+M+")",G)
  8383. }else{return Klib.Content.getBlockHtml("downloadableFiles","{metadata.downloadablefiles.title} (0)","","{metadata.downloadablefiles.none}")
  8384. }};
  8385. Klib.Content.getBlockHtml=function(P,S,O,E,F,D,L){if(!S&&!O){return""
  8386. }S=S||P;
  8387. var Q=Klib.Pref.get("Metadata."+P+".minimize");
  8388. var M=Q?' style="display: none"':"";
  8389. var K=(Q?"{show}":"{hide}")+" "+P;
  8390. var A;
  8391. var N;
  8392. var C;
  8393. if(O){C="";
  8394. A=Klib.sprites["metadata-"+(Q?"show":"hide")].getHTML({title:K,toggleTitleShow:"{show} "+P,toggleTitleHide:"{hide} "+P,preferenceid:"Metadata."+P+".minimize",togglePrefValue:"true",toggleTarget:"metadata-"+P+"-content, metadata-"+P+"-footer",prefValue:(Q?"false":"true"),"class":"toggle metadata-hide-button"});
  8395. N=""
  8396. }else{C="metadata-block-disabled";
  8397. A="";
  8398. N=E
  8399. }var G=Klib.sprites["metadata-close"].getHTML({title:"{close} "+P,preferenceid:"Metadata."+P+".enabled","class":"metadata-close-button",preferenceConfirm:"{metadata.confirm.remove.block}",preferenceToggleTarget:"metadata-"+P+"-block",prefValue:"false",preferenceUseClueFrameConfirm:"true"});
  8400. var H=Klib.sprites[P].getHTML();
  8401. if(P=="siteInfo"&&Klib.FavIcon.getCurrFavIconUrl(F)){H=Klib.Html.tag("img",{src:Klib.FavIcon.getCurrFavIconUrl(F),width:16,height:16})
  8402. }var J=H+" "+S;
  8403. if(F){J='<a id="metadata-'+P+'-title-link" href="'+F+'">'+J+"</a>"
  8404. }J='<div class="metadata-title" id="metadata-'+P+'-title" tooltip="'+Klib.htmlspecialchars(N)+'"><h3>'+G+A+J+"</h3></div>";
  8405. var B='<div class="metadata-content" id="metadata-'+P+'-content"'+M+">"+O+"</div>";
  8406. var R=L?'<div class="metadata-footer" id="metadata-'+P+'-footer"'+M+">"+L+"</div>":"";
  8407. var I='<div class="metadata-block '+C+" "+D+'" id="metadata-'+P+'-block">'+J+B+R+"</div>";
  8408. return Klib.translate(I)
  8409. };
  8410. Klib.Content.getLanguagesFromUTF8String=function(F){var C=30;
  8411. var B="";
  8412. var E={};
  8413. var K=879;
  8414. E[1023]="Greek and Coptic";
  8415. E[1279]="Cyrillic";
  8416. E[1327]="Cyrillic Supplementary";
  8417. E[1423]="Armenian";
  8418. E[1535]="Hebrew";
  8419. E[1791]="Arabic";
  8420. E[1871]="Syriac";
  8421. E[1983]="Thaana";
  8422. E[2431]="Devanagari";
  8423. E[2559]="Bengali";
  8424. E[2687]="Gurmukhi";
  8425. E[2815]="Gujarati";
  8426. E[2943]="Oriya";
  8427. E[3071]="Tamil";
  8428. E[3199]="Telugu";
  8429. E[3327]="Kannada";
  8430. E[3455]="Malayalam";
  8431. E[3583]="Sinhala";
  8432. E[3711]="Thai";
  8433. E[3839]="Lao";
  8434. E[4095]="Tibetan";
  8435. E[4255]="Myanmar";
  8436. E[4351]="Georgian";
  8437. E[4607]="Hangul Jamo";
  8438. E[4991]="Ethiopic";
  8439. E[5119]="Cherokee";
  8440. E[5759]="Unified Canadian Aboriginal Syllabics";
  8441. E[5791]="Ogham";
  8442. E[5887]="Runic";
  8443. E[5919]="Tagalog";
  8444. E[5951]="Hanunoo";
  8445. E[5983]="Buhid";
  8446. E[6015]="Tagbanwa";
  8447. E[6143]="Khmer";
  8448. E[6319]="Mongolian";
  8449. E[6479]="Limbu";
  8450. E[6527]="Tai Le";
  8451. var J=6527;
  8452. var A={};
  8453. for(var D=0;
  8454. D<F.length;
  8455. D++){var G=F.charCodeAt(D);
  8456. if((G>K)&&(G<=J)){for(var L in E){if(G<=L){var B=E[L];
  8457. A[B]=A[B]?(A[B]+1):1;
  8458. break
  8459. }}}}var I=[];
  8460. for(var H in A){if(A[H]>C){I.push(H)
  8461. }}return I
  8462. };
  8463. Klib.Content.languageInfo=function(A){var B={};
  8464. B["iso-8859-1"]="Western";
  8465. B["iso-8859-2"]="Central European";
  8466. B["iso-8859-3"]="South European";
  8467. B["iso-8859-4"]="Baltic";
  8468. B["iso-8859-5"]="Cyrillic";
  8469. B["iso-8859-6"]="Arabic";
  8470. B["iso-8859-7"]="Greek";
  8471. B["iso-8859-8"]="Hebrew Visual";
  8472. B["iso-8859-8-i"]="Hebrew";
  8473. B["iso-8859-9"]="Turkish";
  8474. B["iso-8859-10"]="Nordic";
  8475. B["iso-8859-11"]="Thai";
  8476. B["iso-8859-13"]="Baltic";
  8477. B["iso-8859-14"]="Celtic";
  8478. B["iso-8859-15"]="Western";
  8479. B["iso-8859-16"]="Romanian";
  8480. B["iso-2022-cn"]="Chinese Simplified";
  8481. B["iso-2022-jp"]="Japanese";
  8482. B["iso-2022-kr"]="Korean";
  8483. B["ibm-850"]="Western";
  8484. B["ibm-852"]="Central European";
  8485. B["ibm-855"]="Cyrillic";
  8486. B["ibm-857"]="Turkish";
  8487. B["ibm-862"]="Hebrew";
  8488. B["ibm-864"]="Arabic";
  8489. B["windows-874"]="Thai";
  8490. B["windows-1250"]="Central European";
  8491. B["windows-1251"]="Cyrillic";
  8492. B["windows-1252"]="Western";
  8493. B["windows-1253"]="Greek";
  8494. B["windows-1254"]="Turkish";
  8495. B["windows-1255"]="Hebrew";
  8496. B["windows-1256"]="Arabic";
  8497. B["windows-1257"]="Baltic";
  8498. B["windows-1258"]="Vietnamese";
  8499. B.macroman="Western";
  8500. B.macgreek="Greek";
  8501. B.macicelandic="Icelandic";
  8502. B.macce="Central European";
  8503. B.maccroatian="Croatian";
  8504. B.maccyrillic="Cyrillic";
  8505. B.macukranian="Cyrillic/Ukrainian";
  8506. B.macromanian="Romanian";
  8507. B.macturkish="Turkish";
  8508. B.macdevanagari="Hindi";
  8509. B.macgujarati="Gujarati";
  8510. B.macgurmukhi="Gurmukhi";
  8511. B.macarabic="Arabic";
  8512. B.macfarsi="Farsi";
  8513. B.machebrew="Hebrew";
  8514. B["us-ascii"]="English";
  8515. B["iso-ir-111"]="Cyrillic";
  8516. B["koi8-r"]="Cyrillic";
  8517. B["koi8-u"]="Cyrillic/Ukrainian";
  8518. B["cp-866"]="Cyrillic/Russian";
  8519. B.gbk="Chinese Simplified";
  8520. B.gb2312="Chinese Simplified";
  8521. B.gb18030="Chinese Simplified";
  8522. B.hz="Chinese Simplified";
  8523. B.big5="Chinese Traditional";
  8524. B["big5-hkscs"]="Chinese Traditional";
  8525. B["euc-tw"]="Chinese Traditional";
  8526. B["euc-jp"]="Japanese";
  8527. B["euc-kr"]="Korean";
  8528. B.shift_jis="Japanese";
  8529. B.uhc="Korean";
  8530. B.johab="Korean";
  8531. B["armscii-8"]="Armenian";
  8532. B.geostd8="Georgian";
  8533. B["tis-620"]="Thai";
  8534. B.tcvn="Vietnamese";
  8535. B.viscii="Vietnamese";
  8536. B.vps="Vietnamese";
  8537. var D="";
  8538. if(A.charset&&B[A.charset]){D+="<p>"+B[A.charset]+"</p>"
  8539. }if(A.text){var E=Klib.Content.getLanguagesFromUTF8String(A.text);
  8540. if(E.length){D+="<p>{metadata.languageinfo.list.before}";
  8541. D+="<ul>";
  8542. for(var C=0;
  8543. C<E.length;
  8544. C++){D+="<li>"+E[C]+"</li>"
  8545. }D+="</ul>{metadata.languageinfo.list.after}</p>"
  8546. }}return Klib.Content.getBlockHtml("languageInfo","{metadata.languageinfo.title}",D,"{metadata.languageinfo.none}")
  8547. };
  8548. Klib.Content.feeds=function(A){var D="";
  8549. if(A.feeds&&A.feeds.length){var F="";
  8550. var C="";
  8551. for(var B=0;
  8552. B<A.feeds.length;
  8553. B++){var E=A.feeds[B];
  8554. if(E.feedType=="rss"){F+='<li><a href="'+Klib.htmlspecialchars(E.url)+'" >'+Klib.htmlspecialchars(E.title)+"</a></li>"
  8555. }else{if(E.feedType=="atom"){C+='<li><a href="'+Klib.htmlspecialchars(E.url)+'" >'+Klib.htmlspecialchars(E.title)+"</a></li>"
  8556. }}}if(F){D+='<ul id="metadata-feed-list-rss">'+F+"</ul>"
  8557. }if(C){D+='<ul id="metadata-feed-list-atom">'+C+"</ul>"
  8558. }}return Klib.Content.getBlockHtml("feeds","{metadata.feeds.title}",D,"{metadata.feeds.none}")
  8559. };
  8560. Klib.Content.thumbnailBox=function(A){return'<div id="interclue-thumbnail-box">                   <div id="interclue-thumbnail-image-box">'+A+"</div>                </div>"
  8561. };
  8562. Klib.Content.thumbnailUpdateContent=function(){if(Klib.ClueFrame.contentFrame&&Klib.ClueFrame.contentFrame.doc){var B=Klib.Clue.currentClue;
  8563. var A=$("interclue-thumbnail-image-box",Klib.ClueFrame.contentFrame.doc);
  8564. if(A&&B&&B.link&&B.link.href){A.innerHTML=Klib.Content.thumbnail(Klib.getFixedHref(B.link),true)
  8565. }}};
  8566. Klib.Content.thumbnailHandleComplete=function(A){var B=Klib.Clue.currentClue;
  8567. if(B&&B.link&&B.link.href&&Klib.ClueFrame.isVisible()){if(Klib.Thumbnail.getImg(Klib.getFixedHref(B.link))==A){Klib.Content.thumbnailUpdateContent()
  8568. }}};
  8569. Klib.Content.thumbnail=function(B,A){var D="";
  8570. B=Klib.Url.removeRedirect(B);
  8571. var E=Klib.Url.parse(B);
  8572. var H=Klib.Thumbnail.getImg(E);
  8573. var G=Klib.Thumbnail.provider();
  8574. switch(H.state){case"init":D=Klib.string("metadata.thumbnail.loading")+Klib.sprites.loading.getHTML();
  8575. H.fetch(Klib.Content.thumbnailHandleComplete);
  8576. break;
  8577. case"fetching":D=Klib.string("metadata.thumbnail.loading")+Klib.sprites.loading.getHTML();
  8578. H.onComplete=Klib.Content.thumbnailHandleComplete;
  8579. break;
  8580. case"success":if(G.validateImage(H)){var F='<h3 id="interclue-thumbnail-tooltip-heading">'+E.domain+"</h3><p>"+G.getAttribution(true)+"</p>";
  8581. var C={};
  8582. C.domain=E.domain;
  8583. C.url=E.url;
  8584. C.thumbnailUrl=H.url;
  8585. C.thumbnailSize=H.sizeHTML();
  8586. C.tooltip=Klib.htmlspecialchars(F);
  8587. D=Klib.substitute('<a href="{url}"><img id="interclue-thumbnail-image" src="{thumbnailUrl}" border="0" {thumbnailSize} tooltip="{tooltip}" /></a>',C)
  8588. }else{D=Klib.string("metadata.thumbnail.not.available")
  8589. }break;
  8590. case"aborted":case"error":D=Klib.string("metadata.thumbnail.not.found");
  8591. break;
  8592. default:Klib.error("Unknown thumbnail state",H.state);
  8593. break
  8594. }return A?D:'<div id="interclue-thumbnail-box"><div id="interclue-thumbnail-image-box">'+D+"</div></div>"
  8595. };
  8596. Klib.Content.diggButton=function(C){C=Klib.Url.removeRedirect(C);
  8597. var A="http://digg.com/tools/diggthis.php?s=compact&u="+encodeURIComponent(Klib.Url.noHash(C));
  8598. A+="&k="+escape("#ffffdd");
  8599. var B='<iframe id="interclue-digg-frame" src="'+Klib.htmlspecialchars(A)+'" width="120" height="18" frameborder="0" scrolling="no"></iframe>';
  8600. return Klib.Content.getBlockHtml("digg","Digg This",B,"http://digg.com/","metadata-block-3rd-party")
  8601. };
  8602. Klib.Content.moreMetadataLink=function(){return'<div class="metadata-block" id="metadata-more"><a href="javascript:;" prefpage="metadata">'+Klib.string("metadata.link.more")+"</a></div>"
  8603. };
  8604. Klib.Content.privacyWarning=function(A){var B;
  8605. if(/^https:/i.test(A)){B="<p>{privacy.rule.content.https}</p>"
  8606. }else{B='<p>{privacy.rule.content}</p><h4>{privacy.rule.list.title}</h4><ul id="metadata-privacy-warning-urls"><li>'+Klib.Clue.matchPrivateUrl(A).join("</li></li>")+"</li></ul>"
  8607. }return Klib.Content.getBlockHtml("privacyWarning","{privacy.rule.title}",B)
  8608. };
  8609. Klib.Content.getAuthorInfo=function(A){return Klib.Content.getBlockHtml("authorInfo","Author Info",A.authorInfoHTML,"","","metadata-block-destination")
  8610. };
  8611. Klib.Content.getSiteInfo=function(A){return Klib.Content.getBlockHtml("siteInfo","Site Info",A.siteInfoHTML,"",A.htmldoc.url,"metadata-block-destination")
  8612. };
  8613. Klib.Content.floater=function(C){var A="";
  8614. var B=Klib.Clue.isPrivateUrl(C.htmldoc.url);
  8615. if(Klib.Pref.get("Metadata.thumbnails.enabled",true)&&!B){A+=Klib.Content.thumbnail(C.htmldoc.url)
  8616. }if(Klib.Pref.get("Metadata.published.enabled",true)){A+=Klib.Content.getPublishedInfo(C)
  8617. }if(Klib.Pref.get("Metadata.microsummary.enabled",true)){A+=Klib.Content.microsummary(C)
  8618. }if(Klib.Pref.get("Metadata.downloadableFiles.enabled",true)){A+=Klib.Content.downloadableFiles(C)
  8619. }if(Klib.Pref.get("Metadata.feeds.enabled",true)){A+=Klib.Content.feeds(C.htmldoc)
  8620. }if(Klib.Pref.get("Metadata.pageStats.enabled",true)){A+=Klib.Content.pageStats(C)
  8621. }if(Klib.Pref.get("Metadata.languageInfo.enabled",true)){A+=Klib.Content.languageInfo(C.htmldoc)
  8622. }if(Klib.Pref.get("Metadata.delicious.enabled",true)&&!B){A+=Klib.Delicious.htmlBlock(Klib.getFixedHref(C.link))
  8623. }if(Klib.Pref.get("Metadata.digg.enabled",true)&&!B&&!Klib.Tutorial.isTutorialUrl(C.link.ownerDocument.URL)){A+=Klib.Content.diggButton(Klib.getFixedHref(C.link))
  8624. }if(Klib.Pref.get("Metadata.privacyWarning.enabled",true)&&B){A+=Klib.Content.privacyWarning(C.htmldoc.url)
  8625. }if(A&&Klib.Pref.get("Metadata.addRemove.enabled",true)){A+=Klib.Content.moreMetadataLink()
  8626. }return A?'<div id="interclue-content-floater">'+A+"</div><!--interclue-content-floater-->":""
  8627. };
  8628. Klib.Content.partialDocumentWarning=function(B,E){var C="";
  8629. if(!B.fullyRetrieved){var D=Klib.byteSize(B.responseText.length);
  8630. var A=(B.contentLength)?Klib.byteSize(B.contentLength):"{unknown}";
  8631. C='<em class="interclue-footnote">'+Klib.string("metadata.partial.document.warning")+"</em>"
  8632. }return C
  8633. };
  8634. Klib.Content.linkInfo=function(F){var C=F.htmldoc;
  8635. var B=500;
  8636. var H={};
  8637. H.internal=0;
  8638. H.external=0;
  8639. H.other=0;
  8640. C.parsedLinks=[];
  8641. for(var E=0;
  8642. E<C.links.length;
  8643. E++){if(C.links[E]){var I=Klib.Url.parse(C.links[E]);
  8644. if(I){C.parsedLinks.push(I);
  8645. if(I.basedomain==C.parsedUrl.basedomain){H.internal++
  8646. }else{H.external++
  8647. }}else{Klib.error("Unable to parse url",C.links[E])
  8648. }}else{H.other++
  8649. }}var G=new Klib.BarGraph("interclue-content-link-stats");
  8650. G.addData("linksInternal",H.internal);
  8651. G.addData("linksExternal",H.external);
  8652. G.addData("linksOther",H.other);
  8653. H.total=H.external+H.internal+H.other;
  8654. var D=H.total/B;
  8655. D=Klib.limit(D,0,1);
  8656. G.cssWidth=Klib.percent(D)+"%";
  8657. var A=Klib.Content.partialDocumentWarning(C,"{metadata.title.links}");
  8658. G.overlayText=H.total+" {metadata.title.links}"+(A?"+":"");
  8659. G.tooltip="<h3>{metadata.title.links} : "+H.total+(A?"*":"")+"</h3><hr /><ul>";
  8660. G.tooltip+=(H.internal)?"<li>{metadata.title.internal} : "+H.internal+"</li>":"";
  8661. G.tooltip+=(H.external)?"<li>{metadata.title.external} : "+H.external+"</li>":"";
  8662. G.tooltip+=(H.other)?"<li>{metadata.title.other} : "+H.other+"</li>":"";
  8663. G.tooltip+="</ul>";
  8664. G.tooltip+=(A?A:"");
  8665. return G.getTotal()?G.getHTML():""
  8666. };
  8667. Klib.Content.incompleteDocumentWarning=function(A){var B="<h3>{metadata.partial.document.title}</h3><hr /><p>{metadata.partial.document.warning}</p>";
  8668. return'<div class="interclue-bargraph-incomplete" tooltip="'+Klib.htmlspecialchars(B)+'">+</div>'
  8669. };
  8670. Klib.arrayReduce=function(A){var E={};
  8671. var C=[];
  8672. for(var B=0;
  8673. B<A.length;
  8674. B++){var D=A[B];
  8675. if(!E[D]){E[D]=true;
  8676. C.push(D)
  8677. }}return C
  8678. };
  8679. Klib.Content.textStats=function(H){var E=H.htmldoc;
  8680. var M=5000;
  8681. var I=new Klib.BarGraph("interclue-content-text-stats");
  8682. var C="";
  8683. switch(H.id){case"ajaxSummariser":C="summary";
  8684. break;
  8685. default:C="content";
  8686. break
  8687. }var K=Klib.wordCount(E.text);
  8688. var D=Klib.wordCount(H.getSub(C),true);
  8689. var J=(E.contentWordCount||0);
  8690. var L=(J-D);
  8691. if(L<0){L=0
  8692. }var G=K-(D+L);
  8693. if(G<0){G=0
  8694. }I.addData("summaryWordCount",D);
  8695. I.addData("contentWordCount",L);
  8696. I.addData("navWordCount",G);
  8697. var B=I.getTotal();
  8698. var F=(B/M);
  8699. F=Klib.limit(F,0,1);
  8700. I.cssWidth=Klib.percent(F)+"%";
  8701. var A=Klib.Content.partialDocumentWarning(E,"{metadata.title.words}");
  8702. I.overlayText=B+" {metadata.title.words}"+(A?"+":"");
  8703. I.tooltip="<h3>{metadata.title.text} : "+B+(A?"*":"")+" {metadata.title.words}</h3>";
  8704. if(E.contentWordCount){I.tooltip+="<hr /><p>"+Klib.percent(D/B)+"% {metadata.words.percent.in.clue}<br />"+Klib.percent(L/B)+"% {metadata.words.additional.content}<br />"+Klib.percent(G/B)+"% {metadata.words.in.template}</p>"
  8705. }I.tooltip+=(A?A:"");
  8706. return I.getTotal()?I.getHTML():""
  8707. };
  8708. Klib.BarGraph=function(B){var A=this;
  8709. A.id=B;
  8710. A.data={};
  8711. A.text="";
  8712. A.title="";
  8713. A.tooltip="";
  8714. A.cssWidth="100%";
  8715. A.scale="normal";
  8716. A.overlayText="";
  8717. A.getHTML=function(){var E=A.getTotal();
  8718. var G=(100/E);
  8719. var F="";
  8720. for(var D in A.data){F+='<div class="interclue-bargraph-bar-section interclue-bargraph-bar-section-'+D+'" style="width: '+(A.data[D]*G)+'%"></div>'
  8721. }var C='<div id="'+A.id+'" class="interclue-bargraph-bar" tooltip="'+Klib.htmlspecialchars(A.tooltip)+'" >                <div class="interclue-bargraph-solid-bar" style="width: '+A.cssWidth+'">'+F+'</div>                <div class="interclue-bargraph-bar-overlay">'+A.overlayText+"</div>            </div>";
  8722. return Klib.translate(C)
  8723. };
  8724. A.getTotal=function(){var D=0;
  8725. for(var C in A.data){D+=A.data[C]
  8726. }return D
  8727. };
  8728. A.addData=function(C,D){if(D<0){D=0
  8729. }A.data[C]=D
  8730. }
  8731. };
  8732. Klib.Content.resourceStats=function(H){var D=H.htmldoc;
  8733. var B=100;
  8734. var E=D.stats.resources;
  8735. var G={};
  8736. G.resourcesTotal=0;
  8737. G.resourceList="";
  8738. G.resourceList="<ul>";
  8739. for(var J in E){var C=Klib.arrayReduce(E[J]);
  8740. if(C.length){G.resourcesTotal+=C.length;
  8741. G.resourceList+="<li> "+C.length+" "+J+"</li>"
  8742. }E[J]=C
  8743. }G.resourceList+="</ul>";
  8744. var A=Klib.Content.partialDocumentWarning(D,"{metadata.title.files}");
  8745. var I=new Klib.BarGraph("interclue-content-resource-stats");
  8746. I.tooltip="<h3>{metadata.title.files} : "+G.resourcesTotal+(A?"*":"")+"</h3><hr /><p>"+Klib.string("metadata.files.content",G.resourcesTotal)+"</p>"+G.resourceList;
  8747. I.tooltip+=(A?A:"");
  8748. I.overlayText=G.resourcesTotal+" {metadata.title.files}"+(A?"+":"");
  8749. for(var J in E){I.addData(J,E[J].length)
  8750. }var F=(G.resourcesTotal)/(B);
  8751. F=Klib.limit(F,0,1);
  8752. I.cssWidth=Klib.percent(F)+"%";
  8753. return I.getTotal()?I.getHTML():""
  8754. };
  8755. Klib.Content.published=function(D){var Q=2;
  8756. var F=7;
  8757. var O=30;
  8758. var C=365;
  8759. var I=false;
  8760. var K="";
  8761. var B="";
  8762. var E=Klib.getFixedHref(D.link);
  8763. if(E.match(/\b(\d{2,4})[\/\-](\d{1,2})[\/\-](\d{2,4})\b/)){var A=E.match(/\b(\d{2,4})[\/\-](\d{1,2})[\/\-](\d{2,4})\b/);
  8764. var P=A[1];
  8765. var N=parseInt(A[2])-1;
  8766. var J=A[3];
  8767. var L=new Date();
  8768. if(Klib.getDate(A[0],L)){I=Klib.getDate(A[0],L)
  8769. }else{if(Klib.getDate(J+"/"+N+"/"+P,L)){I=Klib.getDate(J+"/"+N+"/"+P,L)
  8770. }else{if(Klib.getDate("20"+J+"/"+N+"/"+P,L)){I=Klib.getDate("20"+J+"/"+N+"/"+P,L)
  8771. }else{if(Klib.getDate("19"+J+"/"+N+"/"+P,L)){I=Klib.getDate("19"+J+"/"+N+"/"+P,L)
  8772. }else{if(Klib.getDate(J+"/"+N+"/20"+P,L)){I=Klib.getDate(J+"/"+N+"/20"+P,L)
  8773. }else{if(Klib.getDate(J+"/"+N+"/19"+P,L)){I=Klib.getDate(J+"/"+N+"/19"+P,L)
  8774. }}}}}}if(I){K=Klib.string("metadata.date.url");
  8775. B=" *"
  8776. }}if(!I){if(!I&&D.htmldoc.meta.date){I=new Date(D.htmldoc.meta.date);
  8777. K=Klib.string("metadata.date.meta.tag")
  8778. }else{if(!I&&D.htmldoc.headers.last_modified){I=new Date(D.htmldoc.headers.last_modified);
  8779. K=Klib.string("metadata.date.headers")
  8780. }}if(I&&!isNaN(I)){var G=new Date();
  8781. var M=parseInt((G.getTime()-I.getTime())/(24*60*60*1000));
  8782. if(M<Q){I=null
  8783. }}}if(I&&!isNaN(I)){var G=new Date();
  8784. var M=parseInt((G.getTime()-I.getTime())/(24*60*60*1000));
  8785. var H="";
  8786. var R="";
  8787. if(M<=(2*F)){H=M+" "+Klib.string("unit.days");
  8788. R="interclue-metadata-published-days"
  8789. }else{if(M<=(2*O)){H=parseInt(M/F)+" "+Klib.string("unit.weeks");
  8790. R="interclue-metadata-published-weeks"
  8791. }else{if(M<=(2*C)){H=parseInt(M/O)+" "+Klib.string("unit.months");
  8792. R="interclue-metadata-published-months"
  8793. }else{H=parseInt(M/C)+" "+Klib.string("unit.years");
  8794. R="interclue-metadata-published-years"
  8795. }}}return'<div id="interclue-content-published-date" class="'+R+'" tooltip="'+K+'" >'+Klib.formatDate(I)+" ("+H+")"+B+"</div>"
  8796. }return""
  8797. };
  8798. Klib.Content.getPublishedInfo=function(B){var A=Klib.Content.published(B);
  8799. return Klib.Content.getBlockHtml("published",Klib.string("metadata.published.title"),A,Klib.string("metadata.published.none"))
  8800. };
  8801. Klib.Content.pageStats=function(B){Klib.profile("Klib.Content.pageStats-start");
  8802. var A="";
  8803. A+=Klib.Content.textStats(B);
  8804. A+=Klib.Content.linkInfo(B);
  8805. A+=Klib.Content.resourceStats(B);
  8806. Klib.profile("Klib.Content.pageStats-end");
  8807. return Klib.Content.getBlockHtml("pageStats","{metadata.stats.title}",A,Klib.string("metadata.stats.none"))
  8808. }
  8809. }Klib.rect=function(E,D,B,A){var C={left:parseInt(E),top:parseInt(D),width:parseInt(B),height:parseInt(A),bottom:parseInt(D)+parseInt(A),right:parseInt(E)+parseInt(B),setLeft:function(F){this.left=parseInt(F);
  8810. this.right=this.left+this.width
  8811. },setRight:function(F){this.right=parseInt(F);
  8812. this.left=this.right-this.width
  8813. },setTop:function(F){this.top=parseInt(F);
  8814. this.bottom=this.top+this.height
  8815. },setBottom:function(F){this.bottom=parseInt(F);
  8816. this.top=this.bottom-this.height
  8817. },setWidth:function(F){this.width=parseInt(F);
  8818. this.right=this.left+this.width
  8819. },setHeight:function(F){this.height=parseInt(F);
  8820. this.bottom=this.top+this.height
  8821. },expand:function(G){G=parseInt(G);
  8822. var F=Math.floor(G/2);
  8823. this.setLeft(this.left-F);
  8824. this.setTop(this.top-F);
  8825. this.setWidth(this.width+G);
  8826. this.setHeight(this.height+G)
  8827. },resize:function(I,F,H){H=H||"center";
  8828. var G=I-this.width;
  8829. var J=I-this.width;
  8830. switch(H){case"center":this.setLeft(this.left-Math.ceil(G/2));
  8831. this.setTop(this.top-Math.ceil(J/2));
  8832. break;
  8833. case"top-left":break;
  8834. case"top-right":this.setLeft(this.left-G);
  8835. break;
  8836. case"bottom-left":this.setTop(this.top-J);
  8837. break;
  8838. case"bottom-right":this.setTop(this.top-J);
  8839. this.setLeft(this.left-G);
  8840. break;
  8841. default:break
  8842. }this.setWidth(I);
  8843. this.setHeight(F)
  8844. },clone:function(){var F=new Klib.rect(this.left,this.top,this.width,this.height);
  8845. return F
  8846. }};
  8847. return C
  8848. };
  8849. Klib.getWinRect=function(E){var D=(typeof E.screenX=="number")?E.screenX:(E.screenLeft-Klib.ClueFrame.IEWindowChromeOffsetLeft);
  8850. var C=(typeof E.screenY=="number")?E.screenY:(E.screenTop-Klib.ClueFrame.IEWindowChromeOffsetTop);
  8851. var B=E.outerWidth||E.document.body.clientWidth;
  8852. var A=E.outerHeight||E.document.body.clientHeight;
  8853. return Klib.rect(D,C,B,A)
  8854. };
  8855. Klib.getBodyRect=function(A){return Klib.rect(0,0,A.scrollWidth,A.scrollHeight)
  8856. };
  8857. Klib.getAbsRect=function(L){var B=L;
  8858. var D=0;
  8859. var K=0;
  8860. var I=(L.offsetWidth?L.offsetWidth:L.clientWidth);
  8861. var E=(L.offsetHeight?L.offsetHeight:L.clientHeight);
  8862. var H=L.ownerDocument;
  8863. if(H.getBoxObjectFor){var G=Klib.getBox(L);
  8864. if(G){var J=Klib.getStyle(H.body,"position");
  8865. var F=(J=="fixed"||J=="absolute")?Klib.getBox(H.body):Klib.getBox(H.documentElement);
  8866. I=G.width;
  8867. E=G.height;
  8868. D=G.screenX-F.screenX;
  8869. K=G.screenY-F.screenY;
  8870. return Klib.rect(D,K,I,E)
  8871. }}if(L.getBoundingClientRect){var A=L.getBoundingClientRect();
  8872. D=A.left;
  8873. K=A.top;
  8874. D+=(H.documentElement.scrollLeft>H.body.scrollLeft)?H.documentElement.scrollLeft:H.body.scrollLeft;
  8875. K+=(H.documentElement.scrollTop>H.body.scrollTop)?H.documentElement.scrollTop:H.body.scrollTop;
  8876. D-=2;
  8877. K-=2;
  8878. if(Klib.docRenderMode(H)!="standards"){D-=Klib.getStyle(H.body,"borderLeftWidth","int");
  8879. K-=Klib.getStyle(H.body,"borderTopWidth","int")
  8880. }}else{while(L.offsetParent){if(Klib.tagname(L)!="body"&&Klib.tagname(L)!="html"){D+=parseInt(L.offsetLeft)||0;
  8881. K+=parseInt(L.offsetTop)||0;
  8882. if(Klib.getStyle(L,"position")=="fixed"){D+=(H.documentElement.scrollLeft>H.body.scrollLeft)?H.documentElement.scrollLeft:H.body.scrollLeft;
  8883. K+=(H.documentElement.scrollTop>H.body.scrollTop)?H.documentElement.scrollTop:H.body.scrollTop;
  8884. break
  8885. }}var C=L.offsetParent;
  8886. while(L!=C){D-=parseInt(L.scrollLeft)||0;
  8887. K-=parseInt(L.scrollTop)||0;
  8888. L=L.parentNode
  8889. }}if(Klib.isMoz||Klib.docRenderMode(H)=="standards"){D+=Klib.getStyle(H.body,"borderLeftWidth","int");
  8890. K+=Klib.getStyle(H.body,"borderTopWidth","int")
  8891. }}return Klib.rect(D,K,I,E)
  8892. };
  8893. Klib.getEleRect=function(F,A){var G=F;
  8894. var D=F.offsetTop;
  8895. var C=F.offsetLeft;
  8896. var B=(F.offsetWidth?F.offsetWidth:F.clientWidth);
  8897. var E=(F.offsetHeight?F.offsetHeight:F.clientHeight);
  8898. while(F.offsetParent){if(A&&F.offsetParent.tagName=="BODY"&&(F.offsetParent.offsetTop||F.offsetParent.offsetLeft)){var H=Klib.getStyle(F,"position");
  8899. if(H!="absolute"&&H!="fixed"){break
  8900. }}F=F.offsetParent;
  8901. D+=F.offsetTop;
  8902. C+=F.offsetLeft
  8903. }if(A){F=G;
  8904. while(F&&(F.scrollTop!==undefined)&&(F.tagName!="BODY")){var H=Klib.getStyle(F,"position");
  8905. if(H=="absolute"||H=="fixed"){F=F.offsetParent
  8906. }else{D-=F.scrollTop;
  8907. C-=F.scrollLeft;
  8908. F=F.parentNode
  8909. }}}return Klib.rect(C,D,B,E)
  8910. };
  8911. Klib.rectFitInRect=function(D,C,B){B=B||false;
  8912. if((D.width>C.width)||(D.height>C.height)){Klib.warning("Klib.rectFitInRect() needle is too large to fit into container",D,C);
  8913. return false
  8914. }else{var A=Klib.rect(D.left,D.top,D.width,D.height);
  8915. if(A.left<C.left){A.setLeft(C.left)
  8916. }else{if(A.right>C.right){A.setRight(C.right)
  8917. }}if(A.top<C.top){A.setTop(C.top)
  8918. }else{if(A.bottom>C.bottom){A.setBottom(C.bottom)
  8919. }}return A
  8920. }};
  8921. Klib.toInt=function(A){return parseInt(A,10)||0
  8922. };
  8923. Klib.getBox2=function(F){var E={};
  8924. var G=F.ownerDocument;
  8925. if(F.getBoundingClientRect){var D=F.getBoundingClientRect();
  8926. return new Klib.rect(D.left,D.top,D.right-D.left,D.bottom-D.top)
  8927. }else{if(G.getBoxObjectFor){var C=G.getBoxObjectFor(F);
  8928. var A=C.x;
  8929. var H=C.y;
  8930. var B=F.parentNode;
  8931. while(B&&B!=G.body){A-=Klib.toInt(B.scrollLeft);
  8932. H-=Klib.toInt(B.scrollTop);
  8933. B=B.parentNode
  8934. }return new Klib.rect(A,H,C.width,C.height)
  8935. }else{return null
  8936. }}};
  8937. Klib.getBox=function(B){var D=Klib.getDoc(B);
  8938. try{var A=D.getBoxObjectFor(B);
  8939. return{screenX:A.screenX,screenY:A.screenY,width:A.width,height:A.height,x:A.x,y:A.y}
  8940. }catch(C){return null
  8941. }};
  8942. Klib.getScreenRect=function(A){return Klib.rect(A.availLeft||A.left||0,A.availTop||A.top||0,A.availWidth,A.availHeight)
  8943. };
  8944. Klib.getRect=function(A){if(A.tagName){if(A.tagName.toLowerCase()=="body"){return Klib.getBodyRect(A)
  8945. }else{return Klib.getEleRect(A)
  8946. }}else{if(A.availWidth){return Klib.getScreenRect(A)
  8947. }else{if(A.navigator){return Klib.getWinRect(A)
  8948. }else{throw Error("Interclue: Unexpected object type ["+typeof A+"] in Klib.getRect()")
  8949. }}}};
  8950. Klib.getWidth=function(A){return A.offsetWidth?A.offsetWidth:A.clientWidth
  8951. };
  8952. Klib.getHeight=function(A){return A.offsetHeight?A.offsetHeight:A.clientHeight
  8953. };
  8954. Klib.lineIntersectsLine=function(B,C,A,D){return((B>=A&&B<D)||(C>A&&C<=D)||(A>=B&&A<C)||(D>B&&D<=C))
  8955. };
  8956. Klib.getAbsRect2=function(D){var C=0,K=0,G;
  8957. var N=D.offsetWidth;
  8958. var I=D.offsetHeight;
  8959. var M=D.parentNode,J=D,B=D.offsetParent,L=D.ownerDocument,A=false,O=true,Q=false,F=Klib.getStyle(D,"position")=="fixed";
  8960. if(D.getBoundingClientRect){var H=D.getBoundingClientRect();
  8961. P(H.left+Math.max(L.documentElement.scrollLeft,L.body.scrollLeft),H.top+Math.max(L.documentElement.scrollTop,L.body.scrollTop));
  8962. P(-L.documentElement.clientLeft,-L.documentElement.clientTop)
  8963. }else{P(D.offsetLeft,D.offsetTop);
  8964. while(B){P(B.offsetLeft,B.offsetTop);
  8965. if(O&&!/^t(able|d|h)$/i.test(B.tagName)||A&&!Q){E(B)
  8966. }if(!F&&Klib.getStyle(B,"position")=="fixed"){F=true
  8967. }J=/^body$/i.test(B.tagName)?J:B;
  8968. B=B.offsetParent
  8969. }while(M&&M.tagName&&!/^body|html$/i.test(M.tagName)){if(!/^inline|table.*$/i.test(Klib.getStyle(M,"display"))){P(-M.scrollLeft,-M.scrollTop)
  8970. }if(O&&Klib.getStyle(M,"overflow")!="visible"){E(M)
  8971. }M=M.parentNode
  8972. }if((Q&&(F||Klib.getStyle(J,"position")=="absolute"))||(O&&Klib.getStyle(J,"position")!="absolute")){P(-L.body.offsetLeft,-L.body.offsetTop)
  8973. }if(F){P(Math.max(L.documentElement.scrollLeft,L.body.scrollLeft),Math.max(L.documentElement.scrollTop,L.body.scrollTop))
  8974. }}G={top:K,left:C};
  8975. function E(R){P(Klib.getStyle(R,"borderLeftWidth"),Klib.getStyle(R,"borderTopWidth"))
  8976. }function P(R,S){C+=parseInt(R)||0;
  8977. K+=parseInt(S)||0
  8978. }return Klib.rect(C,K,N,I);
  8979. return G
  8980. };
  8981. if(Klib.install("Security",0.1)){Klib.Security.STATE_UNKNOWN=0;
  8982. Klib.Security.STATE_UNSAFE=1;
  8983. Klib.Security.STATE_MOSTLY_SAFE=2;
  8984. Klib.Security.STATE_SAFE=3;
  8985. Klib.Security.unsafeWordList="action admin approve buy cart delete dump flag login logout purchase remove sell subscribe unsubscribe vote".split(/[\s\,]+/g);
  8986. Klib.Security.disableSite=function(A){return Klib.Security.setSecurity(A,Klib.Security.STATE_UNSAFE)
  8987. };
  8988. Klib.Security.disableSiteFromDoc=function(B){if(!B){alert(Klib.string("security.no.doc.found"));
  8989. return false
  8990. }var A=Klib.Url.getSiteFromUrl(B.URL);
  8991. if(A){return Klib.Security.setSecurity(B.URL,Klib.Security.STATE_UNSAFE)
  8992. }else{alert(Klib.string("security.invalid.document"));
  8993. return false
  8994. }};
  8995. Klib.Security.markSiteAsMostlySafe=function(A){return Klib.Security.setSecurity(A,Klib.Security.STATE_MOSTLY_SAFE)
  8996. };
  8997. Klib.Security.markSiteAsSafe=function(A){return Klib.Security.setSecurity(A,Klib.Security.STATE_SAFE)
  8998. };
  8999. Klib.Security.recalcUnsafeLinks=function(D){var A=D.links;
  9000. for(var B=0;
  9001. B<A.length;
  9002. B++){var C=A[B];
  9003. if(C&&C.linkscent&&C.linkscent.isSafe===false){C.linkscent.isSafe=Klib.Security.isSafeLink(C)
  9004. }}};
  9005. Klib.Security.enableSiteFromDoc=function(B){if(!B){alert(Klib.string("security.no.doc.found"));
  9006. return false
  9007. }var A=Klib.Url.getSiteFromUrl(B.URL);
  9008. if(A){return Klib.Security.setSecurity(B.URL,Klib.Security.STATE_UNKNOWN)
  9009. }else{alert(Klib.string("security.invalid.document"));
  9010. return false
  9011. }};
  9012. Klib.Security.setSecurity=function(B,D){var A=Klib.Url.getSiteFromUrl(B);
  9013. if(A){var E=Klib.Pref.get("Security.sites");
  9014. var C=E[A]?E[A]:Klib.Security.STATE_UNKNOWN;
  9015. if(C!=D){E[A]=D;
  9016. Klib.Pref.set("Security.sites",E);
  9017. if(C==Klib.Security.STATE_UNSAFE||D==Klib.Security.STATE_UNSAFE){Klib.GEvent.fire("documentsecuritychange",A)
  9018. }return true
  9019. }}return false
  9020. };
  9021. Klib.Security.isDocEnabled=function(A){return A&&(typeof (A.URL)=="string")&&Klib.Security.isSiteEnabled(A.URL)
  9022. };
  9023. Klib.Security.isSiteEnabled=function(B){var A=Klib.Url.getSiteFromUrl(B);
  9024. var C=Klib.Pref.get("Security.sites");
  9025. return(A&&(!C[A]||C[A]!=Klib.Security.STATE_UNSAFE))
  9026. };
  9027. Klib.Security.isMostlySafeSite=function(B){var A=Klib.Url.getSiteFromUrl(B);
  9028. var C=Klib.Pref.get("Security.sites");
  9029. return(A&&C[A]&&(C[A]==Klib.Security.STATE_SAFE||C[A]==Klib.Security.STATE_MOSTLY_SAFE))
  9030. };
  9031. Klib.Security.isMostlySafeUrl=function(A){A=Klib.Url.canonicalUrl(A);
  9032. var B=Klib.Pref.get("Security.urls");
  9033. return(A&&B[A]&&(B[A]==Klib.Security.STATE_SAFE||B[A]==Klib.Security.STATE_MOSTLY_SAFE))
  9034. };
  9035. Klib.Security.isSafeSite=function(B){var A=Klib.Url.getSiteFromUrl(B);
  9036. var C=Klib.Pref.get("Security.sites");
  9037. return(A&&C[A]&&C[A]==Klib.Security.STATE_SAFE)
  9038. };
  9039. Klib.Security.isSafeUrl=function(A){A=Klib.Url.canonicalUrl(A);
  9040. var B=Klib.Pref.get("Security.urls");
  9041. return(A&&B[A]&&B[A]==Klib.Security.STATE_SAFE)
  9042. };
  9043. Klib.Security.isSafeLink=function(D){var A=Klib.Url.parse(Klib.getFixedHref(D));
  9044. var C=Klib.Url.parse(D.ownerDocument.URL);
  9045. var F=Klib.Url.getSiteFromUrl(D.ownerDocument.URL);
  9046. var B=Klib.Url.getSiteFromUrl(Klib.getFixedHref(D));
  9047. var E=Klib.Url.canonicalUrl(Klib.getFixedHref(D));
  9048. if(!A.success){return true
  9049. }if(Klib.Url.isLocal(A.url)){return false
  9050. }else{if(Klib.Security.isSafeSite(A)||Klib.Security.isSafeSite(C)){return true
  9051. }else{if(Klib.Security.isSafeUrl(A)){return true
  9052. }else{if(Klib.Security.urlContainsUnsafeWords(A)){return false
  9053. }else{return true
  9054. }}}}};
  9055. Klib.Security.markLinkAsSafe=function(A){Klib.Security.markUrlAsSafe(Klib.getFixedHref(A));
  9056. A.linkscent.isSafe=true
  9057. };
  9058. Klib.Security.markUrlAsSafe=function(A){A=Klib.Url.canonicalUrl(A);
  9059. if(A){var B=Klib.Pref.get("Security.urls");
  9060. B[A]=Klib.Security.STATE_SAFE;
  9061. Klib.Pref.set("Security.urls",B)
  9062. }};
  9063. Klib.Security.showWarningForLink=function(C){if(Klib.getFixedHref(C).indexOf("?")==-1){return false
  9064. }if(Klib.getFixedHref(C).indexOf("#")>-1){return false
  9065. }var B=Klib.Url.getSiteFromUrl(Klib.getFixedHref(C));
  9066. if(!B){return false
  9067. }var A=Klib.Url.parse(Klib.getFixedHref(C));
  9068. if(A.success&&A.extension&&(A.extension=="html"||A.extension=="htm"||A.extension=="xhtml"||Klib.LinkScent.fileTypes[A.extension])){return false
  9069. }if(Klib.Security.isMostlySafeSite(C.ownerDocument.URL)){return false
  9070. }if(Klib.Security.isMostlySafeUrl(Klib.getFixedHref(C))){return false
  9071. }return true
  9072. };
  9073. Klib.Security.resetSites=function(A){Klib.Pref.set("Security.sites",{});
  9074. Klib.Pref.set("Security.urls",{});
  9075. Klib.Pref.save();
  9076. Klib.ClueBridge.rebuildDoc();
  9077. if(A===true){alert("Sites Reset")
  9078. }};
  9079. Klib.Security.handleWarningForm=function(A){var E=A.doc;
  9080. var C=$("unsafesite-url",E).value;
  9081. var B=Klib.Url.getSiteFromUrl(C);
  9082. if(B){var D=null;
  9083. if($("unsafesite-no",E).checked){D=Klib.Security.STATE_UNSAFE
  9084. }else{if($("unsafesite-mostly",E).checked){D=Klib.Security.STATE_MOSTLY_SAFE
  9085. }else{if($("unsafesite-yes",E).checked){D=Klib.Security.STATE_SAFE
  9086. }}}if(D){Klib.Security.setSecurity(C,D);
  9087. Klib.ClueFrame.forceRefresh()
  9088. }}else{throw Error("Interclue: Unable to generate site from URL ["+C+"]")
  9089. }};
  9090. Klib.Security.urlContainsUnsafeWords=function(A){A=Klib.Url.parse(A);
  9091. var D=Klib.Security.unsafeWords();
  9092. if(A.path||A.filename||A.query){var C=(A.path+"/"+A.filename+"?"+A.query).toLowerCase();
  9093. for(var B=0;
  9094. B<D.length;
  9095. B++){if(C.indexOf(D[B])>-1){return true
  9096. }}return false
  9097. }else{return false
  9098. }};
  9099. Klib.Security.unsafeWords=function(){var D=Klib.Security.unsafeWordList;
  9100. D=D.concat(Klib.Pref.get("Security.unsafeWords").toLowerCase().split(/[\s\,]+/g));
  9101. var B=[];
  9102. for(var A=0;
  9103. A<D.length;
  9104. A++){var C=Klib.trim(D[A]);
  9105. if(C&&!Klib.inArray(B,C)){B.push(D[A])
  9106. }}return B
  9107. };
  9108. Klib.Security.wrapUnsafeWords=function(B,C){C=C||['<span class="unsafeurl-highlight-unsafe-word">',"</span>"];
  9109. var F=Klib.Security.unsafeWords();
  9110. var A=Klib.Url.parse(B);
  9111. if(A){var E=Klib.htmlspecialchars(A.path+A.filename+(A.query?("?"+A.query):""));
  9112. var D=new RegExp("("+Klib.escapeRegExStr(F)+")","ig");
  9113. var E=E.replace(D,(C[0]+"$1"+C[1]));
  9114. return Klib.htmlspecialchars(A.protocol)+"//"+Klib.htmlspecialchars(A.domain)+E
  9115. }else{Klib.error("Clue.wrapUnsafeWords(): Unable to parse url",B);
  9116. return""
  9117. }}
  9118. }if(Klib.install("Sprites",0.1)){Klib.Sprite=function(E,C,B,D,A){var F=this;
  9119. F.src=E;
  9120. F.srcX=C;
  9121. F.srcY=B;
  9122. F.width=D;
  9123. F.height=A;
  9124. F.getHTML=function(H){var G={width:F.width,height:F.height,style:F.getStyle(),border:0,src:Klib.Image.pixel()};
  9125. G=Klib.merge(G,H);
  9126. return Klib.Html.tag("img",G)
  9127. };
  9128. F.getStyle=function(){var G="background-repeat: no-repeat;";
  9129. G+="background-position: -"+F.srcX+"px -"+F.srcY+"px;";
  9130. G+="background-image: url('"+F.src+"');";
  9131. return G
  9132. };
  9133. F.createImg=function(H){var I=Klib.getDoc(H);
  9134. var G=I.createElement("img");
  9135. F.setImg(G);
  9136. if(Klib.isEle(H)){H.appendChild(G)
  9137. }return G
  9138. };
  9139. F.setImg=function(G){Klib.setProp(G,"src",Klib.Image.pixel());
  9140. Klib.setProp(G,"width",F.width);
  9141. Klib.setProp(G,"height",F.height);
  9142. Klib.setStyle(G,"backgroundRepeat","no-repeat");
  9143. Klib.setStyle(G,"backgroundPosition","-"+F.srcX+"px -"+F.srcY+"px");
  9144. Klib.setStyle(G,"backgroundImage",'url("'+F.src+'")')
  9145. }
  9146. }
  9147. }Klib.buildSprites=function(){var A=Klib.skinUrl()+"/sprites.png";
  9148. Klib.Image.preload(A);
  9149. Klib.sprites={};
  9150. Klib.sprites.bookmark=new Klib.Sprite(A,0,176,32,16);
  9151. Klib.sprites.followCurrentLinkNewTab=new Klib.Sprite(A,32,176,32,16);
  9152. Klib.sprites.followCurrentLink=new Klib.Sprite(A,64,176,32,16);
  9153. Klib.sprites.selectTabForLink=new Klib.Sprite(A,96,176,32,16);
  9154. Klib.sprites.followCurrentLinkNewTabFocus=new Klib.Sprite(A,128,176,32,16);
  9155. Klib.sprites.bookmarkDisabled=new Klib.Sprite(A,0,192,32,16);
  9156. Klib.sprites.followCurrentLinkNewTabDisabled=new Klib.Sprite(A,32,192,32,16);
  9157. Klib.sprites.followCurrentLinkDisabled=new Klib.Sprite(A,64,192,32,16);
  9158. Klib.sprites.selectTabForLinkDisabled=new Klib.Sprite(A,96,192,32,16);
  9159. Klib.sprites.followCurrentLinkNewTabFocusDisabled=new Klib.Sprite(A,128,192,32,16);
  9160. Klib.sprites.email=new Klib.Sprite(A,0,16,16,16);
  9161. Klib.sprites.copyToClipboard=new Klib.Sprite(A,16,16,16,16);
  9162. Klib.sprites.copyLinkUrlToClipboard=new Klib.Sprite(A,32,16,16,16);
  9163. Klib.sprites.print=new Klib.Sprite(A,48,16,16,16);
  9164. Klib.sprites.refresh=new Klib.Sprite(A,64,16,16,16);
  9165. Klib.sprites.fontsizeIncrease=new Klib.Sprite(A,80,16,16,16);
  9166. Klib.sprites.fontsizeDecrease=new Klib.Sprite(A,96,16,16,16);
  9167. Klib.sprites.preferences=new Klib.Sprite(A,112,16,16,16);
  9168. Klib.sprites.feedback=new Klib.Sprite(A,128,16,16,16);
  9169. Klib.sprites.summary=new Klib.Sprite(A,144,16,16,16);
  9170. Klib.sprites.delicious=new Klib.Sprite(A,0,32,16,16);
  9171. Klib.sprites.digg=new Klib.Sprite(A,16,32,16,16);
  9172. Klib.sprites.yahoo=new Klib.Sprite(A,32,32,16,16);
  9173. Klib.sprites.google=new Klib.Sprite(A,48,32,16,16);
  9174. Klib.sprites.quicknote=new Klib.Sprite(A,64,32,16,16);
  9175. Klib.sprites.summaryImagesEnable=new Klib.Sprite(A,80,32,16,16);
  9176. Klib.sprites.summaryImagesDisable=new Klib.Sprite(A,96,32,16,16);
  9177. Klib.sprites.donate=new Klib.Sprite(A,112,32,16,16);
  9178. Klib.sprites.debugSummary=new Klib.Sprite(A,128,32,16,16);
  9179. Klib.sprites.close=new Klib.Sprite(A,144,32,16,16);
  9180. Klib.sprites.clueframeLock=new Klib.Sprite(A,0,48,16,16);
  9181. Klib.sprites.clueframeUnlock=new Klib.Sprite(A,16,48,16,16);
  9182. Klib.sprites.resizer=new Klib.Sprite(A,32,48,16,16);
  9183. Klib.sprites.error=new Klib.Sprite(A,48,48,16,16);
  9184. Klib.sprites.info=new Klib.Sprite(A,64,48,16,16);
  9185. Klib.sprites.warning=new Klib.Sprite(A,80,48,16,16);
  9186. Klib.sprites.ok=new Klib.Sprite(A,96,48,16,16);
  9187. Klib.sprites.ftp=new Klib.Sprite(A,112,48,16,16);
  9188. Klib.sprites.gopher=new Klib.Sprite(A,128,48,16,16);
  9189. Klib.sprites.irc=new Klib.Sprite(A,144,48,16,16);
  9190. Klib.sprites.aim=new Klib.Sprite(A,0,64,16,16);
  9191. Klib.sprites.anchor=new Klib.Sprite(A,16,64,16,16);
  9192. Klib.sprites.anchorExternal=new Klib.Sprite(A,32,64,16,16);
  9193. Klib.sprites.zip=new Klib.Sprite(A,48,64,16,16);
  9194. Klib.sprites.audio=new Klib.Sprite(A,64,64,16,16);
  9195. Klib.sprites.css=new Klib.Sprite(A,80,64,16,16);
  9196. Klib.sprites.exe=new Klib.Sprite(A,96,64,16,16);
  9197. Klib.sprites.flac=new Klib.Sprite(A,112,64,16,16);
  9198. Klib.sprites.flash=new Klib.Sprite(A,128,64,16,16);
  9199. Klib.sprites.gimp=new Klib.Sprite(A,144,64,16,16);
  9200. Klib.sprites.greasemonkey=new Klib.Sprite(A,0,80,16,16);
  9201. Klib.sprites.image=new Klib.Sprite(A,16,80,16,16);
  9202. Klib.sprites.insecure=new Klib.Sprite(A,32,80,16,16);
  9203. Klib.sprites.mp3=new Klib.Sprite(A,48,80,16,16);
  9204. Klib.sprites.excel=new Klib.Sprite(A,64,80,16,16);
  9205. Klib.sprites.powerpoint=new Klib.Sprite(A,80,80,16,16);
  9206. Klib.sprites.word=new Klib.Sprite(A,96,80,16,16);
  9207. Klib.sprites.newWindow=new Klib.Sprite(A,112,80,16,16);
  9208. Klib.sprites.OOCalc=new Klib.Sprite(A,128,80,16,16);
  9209. Klib.sprites.OODraw=new Klib.Sprite(A,144,80,16,16);
  9210. Klib.sprites.OOImpress=new Klib.Sprite(A,0,96,16,16);
  9211. Klib.sprites.OOMath=new Klib.Sprite(A,16,96,16,16);
  9212. Klib.sprites.OOWriter=new Klib.Sprite(A,32,96,16,16);
  9213. Klib.sprites.openedInOtherTab=new Klib.Sprite(A,48,96,16,16);
  9214. Klib.sprites.pdf=new Klib.Sprite(A,64,96,16,16);
  9215. Klib.sprites.text=new Klib.Sprite(A,80,96,16,16);
  9216. Klib.sprites.postscript=new Klib.Sprite(A,96,96,16,16);
  9217. Klib.sprites.quicktime=new Klib.Sprite(A,112,96,16,16);
  9218. Klib.sprites.real=new Klib.Sprite(A,128,96,16,16);
  9219. Klib.sprites.secure=new Klib.Sprite(A,144,96,16,16);
  9220. Klib.sprites.siteHound=new Klib.Sprite(A,0,112,16,16);
  9221. Klib.sprites.feed=new Klib.Sprite(A,16,112,16,16);
  9222. Klib.sprites.theGuardian=new Klib.Sprite(A,32,112,16,16);
  9223. Klib.sprites.torrent=new Klib.Sprite(A,48,112,16,16);
  9224. Klib.sprites.trac=new Klib.Sprite(A,64,112,16,16);
  9225. Klib.sprites.movie=new Klib.Sprite(A,80,112,16,16);
  9226. Klib.sprites.webcal=new Klib.Sprite(A,96,112,16,16);
  9227. Klib.sprites.wikipedia=new Klib.Sprite(A,112,112,16,16);
  9228. Klib.sprites.wmv=new Klib.Sprite(A,128,112,16,16);
  9229. Klib.sprites.youtube=new Klib.Sprite(A,144,112,16,16);
  9230. Klib.sprites["blog.com"]=new Klib.Sprite(A,0,128,16,16);
  9231. Klib.sprites["blogs.com"]=new Klib.Sprite(A,16,128,16,16);
  9232. Klib.sprites.blogspot=new Klib.Sprite(A,32,128,16,16);
  9233. Klib.sprites.bugzilla=new Klib.Sprite(A,48,128,16,16);
  9234. Klib.sprites.javascript=new Klib.Sprite(A,64,128,16,16);
  9235. Klib.sprites.news=new Klib.Sprite(A,80,128,16,16);
  9236. Klib.sprites.ogg=new Klib.Sprite(A,96,128,16,16);
  9237. Klib.sprites.unknown=new Klib.Sprite(A,112,128,16,16);
  9238. Klib.sprites.unsafe=new Klib.Sprite(A,128,128,16,16);
  9239. Klib.sprites.tutorial=new Klib.Sprite(A,144,128,16,16);
  9240. Klib.sprites.interclue=new Klib.Sprite(A,0,144,16,16);
  9241. Klib.sprites.interclueExternal=new Klib.Sprite(A,0,144,16,16);
  9242. Klib.sprites.interclueEnabled=new Klib.Sprite(A,16,144,16,16);
  9243. Klib.sprites.interclueFuzzy=new Klib.Sprite(A,32,144,16,16);
  9244. Klib.sprites.interclueDisabled=new Klib.Sprite(A,48,144,16,16);
  9245. Klib.sprites.interclueUnavailable=new Klib.Sprite(A,64,144,16,16);
  9246. Klib.sprites.interclueExternalLink=new Klib.Sprite(A,80,144,16,16);
  9247. Klib.sprites.windows=new Klib.Sprite(A,96,144,16,16);
  9248. Klib.sprites.debugTesting=new Klib.Sprite(A,112,144,16,16);
  9249. Klib.sprites.thumbshots=new Klib.Sprite(A,128,144,16,16);
  9250. Klib.sprites.reddit=new Klib.Sprite(A,144,144,16,16);
  9251. Klib.sprites.historyPrev=new Klib.Sprite(A,0,160,16,16);
  9252. Klib.sprites.historyPrevDisabled=new Klib.Sprite(A,16,160,16,16);
  9253. Klib.sprites.historyNext=new Klib.Sprite(A,32,160,16,16);
  9254. Klib.sprites.historyNextDisabled=new Klib.Sprite(A,48,160,16,16);
  9255. Klib.sprites.safeDomain=new Klib.Sprite(A,64,160,16,16);
  9256. Klib.sprites.safePage=new Klib.Sprite(A,80,160,16,16);
  9257. Klib.sprites.safeUrl=new Klib.Sprite(A,96,160,16,16);
  9258. Klib.sprites.facebook=new Klib.Sprite(A,112,160,16,16);
  9259. Klib.sprites.thumbnails=new Klib.Sprite(A,128,160,16,16);
  9260. Klib.sprites.blank=new Klib.Sprite(A,144,160,16,16);
  9261. Klib.sprites.prevLink=new Klib.Sprite(A,0,208,16,16);
  9262. Klib.sprites.nextLink=new Klib.Sprite(A,16,208,16,16);
  9263. Klib.sprites.prevSimilarLink=new Klib.Sprite(A,32,304,32,16);
  9264. Klib.sprites.nextSimilarLink=new Klib.Sprite(A,64,304,32,16);
  9265. Klib.sprites.prevSimilarLinkDisabled=new Klib.Sprite(A,32,320,32,16);
  9266. Klib.sprites.nextSimilarLinkDisabled=new Klib.Sprite(A,64,320,32,16);
  9267. Klib.sprites.prevLinkDisabled=new Klib.Sprite(A,0,224,16,16);
  9268. Klib.sprites.nextLinkDisabled=new Klib.Sprite(A,16,224,16,16);
  9269. Klib.sprites["html-32"]=new Klib.Sprite(A,64,208,32,32);
  9270. Klib.sprites["text-32"]=new Klib.Sprite(A,96,208,32,32);
  9271. Klib.sprites["pdf-32"]=new Klib.Sprite(A,128,208,32,32);
  9272. Klib.sprites["zip-32"]=new Klib.Sprite(A,0,240,32,32);
  9273. Klib.sprites["audio-32"]=new Klib.Sprite(A,32,240,32,32);
  9274. Klib.sprites["css-32"]=new Klib.Sprite(A,64,240,32,32);
  9275. Klib.sprites["excel-32"]=new Klib.Sprite(A,96,240,32,32);
  9276. Klib.sprites["powerpoint-32"]=new Klib.Sprite(A,128,240,32,32);
  9277. Klib.sprites["word-32"]=new Klib.Sprite(A,0,272,32,32);
  9278. Klib.sprites["image-32"]=new Klib.Sprite(A,32,272,32,32);
  9279. Klib.sprites["movie-32"]=new Klib.Sprite(A,64,272,32,32);
  9280. Klib.sprites["quicktime-32"]=new Klib.Sprite(A,96,272,32,32);
  9281. Klib.sprites["unknown-32"]=new Klib.Sprite(A,128,272,32,32);
  9282. Klib.sprites["exe-32"]=new Klib.Sprite(A,0,304,32,32);
  9283. Klib.sprites["metadata-show"]=new Klib.Sprite(A,0,336,12,12);
  9284. Klib.sprites["metadata-hide"]=new Klib.Sprite(A,16,336,12,12);
  9285. Klib.sprites["metadata-close"]=new Klib.Sprite(A,32,336,12,12);
  9286. Klib.sprites.downloadableFiles=new Klib.Sprite(A,48,336,16,16);
  9287. Klib.sprites.languageInfo=new Klib.Sprite(A,64,336,16,16);
  9288. Klib.sprites.microsummary=new Klib.Sprite(A,80,336,16,16);
  9289. Klib.sprites.feeds=new Klib.Sprite(A,96,336,16,16);
  9290. Klib.sprites.pageStats=new Klib.Sprite(A,112,336,16,16);
  9291. Klib.sprites.privacyWarning=new Klib.Sprite(A,128,336,16,16);
  9292. Klib.sprites.published=new Klib.Sprite(A,144,336,16,16);
  9293. Klib.sprites.stumbleUpon=new Klib.Sprite(A,0,352,16,16);
  9294. Klib.sprites.targetedLink=new Klib.Sprite(A,16,352,16,16);
  9295. Klib.sprites.loading=new Klib.Sprite(A,32,352,16,16);
  9296. Klib.sprites.buttonEditor=new Klib.Sprite(A,48,352,16,16);
  9297. Klib.sprites.buttonDelete=new Klib.Sprite(A,64,352,16,16);
  9298. Klib.sprites.buttonLoad=new Klib.Sprite(A,80,352,16,16);
  9299. Klib.sprites.localFile=new Klib.Sprite(A,96,352,16,16);
  9300. Klib.sprites.authorInfo=new Klib.Sprite(A,112,352,16,16);
  9301. Klib.sprites.siteInfo=new Klib.Sprite(A,128,352,16,16);
  9302. Klib.sprites.newsvine=new Klib.Sprite(A,144,352,16,16);
  9303. Klib.sprites.interclueExternalTiny=new Klib.Sprite(A,0,368,10,10);
  9304. Klib.sprites.interclueFuzzyTiny=new Klib.Sprite(A,10,368,10,10);
  9305. Klib.sprites.targetedLinkTiny=new Klib.Sprite(A,20,368,10,10);
  9306. Klib.sprites.interclueExternalLinkTiny=new Klib.Sprite(A,30,368,10,10);
  9307. Klib.sprites.javascriptTiny=new Klib.Sprite(A,40,368,10,10);
  9308. Klib.sprites["xpi-32"]=new Klib.Sprite(A,96,304,32,32);
  9309. Klib.sprites.turboNote=new Klib.Sprite(A,0,384,16,16);
  9310. Klib.sprites.xpi=new Klib.Sprite(A,16,384,16,16);
  9311. Klib.sprites.menulink=new Klib.Sprite(A,32,384,16,16);
  9312. Klib.sprites.redirect=new Klib.Sprite(A,48,384,16,16);
  9313. Klib.sprites.malware=new Klib.Sprite(A,64,384,16,16);
  9314. Klib.sprites.trademe=new Klib.Sprite(A,80,384,16,16);
  9315. Klib.sprites.koders=new Klib.Sprite(A,96,384,16,16);
  9316. Klib.buildTinySprites()
  9317. };
  9318. Klib.buildTinySprites=function(){var C=Klib.clone(Klib.sprites);
  9319. var H=Klib.skinUrl()+"/spritesTiny.png";
  9320. for(var F in Klib.sprites){var B=Klib.sprites[F];
  9321. var G=parseInt(B.srcX*(10/16));
  9322. var E=parseInt(B.srcY*(10/16));
  9323. var D=parseInt(B.width*(10/16));
  9324. var A=parseInt(B.height*(10/16));
  9325. C[F+"Tiny"]=new Klib.Sprite(H,G,E,D,A)
  9326. }Klib.sprites=C
  9327. };
  9328. Klib.GEvent.addEvent("login",Klib.buildSprites);
  9329. Klib.styles={};
  9330. Klib.getStyles=function(C){var B="";
  9331. var D={};
  9332. if(Klib.ieIE&&Klib.styles[C]&&Klib.styles[C+"-ie"]){D=Klib.merge(Klib.styles[C],Klib.styles[C+"-ie"])
  9333. }else{if(Klib.styles[C]){D=Klib.styles[C]
  9334. }else{throw Error("Klib.LinkScent.getCSS: named style ["+style+"] not found")
  9335. }}for(var A in D){B+=A+": "+D[A]+";"
  9336. }if(Klib.isIE){B=B.replace(/\s*\!important\s*/g,"")
  9337. }return B
  9338. };
  9339. Klib.styles.clear={padding:"0 0 0 0         !important",margin:"0 0 0 0         !important","float":"none            !important",border:"0px solid #f00  !important",background:"transparent none center center !important",width:"auto    !important",height:"auto    !important",display:"inline  !important",overflow:"visible !important",position:"static  !important","text-indent":"0px     !important","z-index":"auto    !important","max-width":"none    !important","min-width":"0       !important","max-height":"none    !important","min-height":"0       !important",left:"auto !important",top:"auto !important",bottom:"auto !important",right:"auto !important","line-height":"16px  !important","white-space":"nowrap !important"};
  9340. Klib.styles["linkscent-iconblock"]=Klib.merge(Klib.styles.clear,{display:"block !important"});
  9341. Klib.styles["linkscent-icon"]=Klib.merge(Klib.styles.clear,{width:"16px !important",height:"16px !important",position:"absolute !important","z-index":"2147483645    !important",margin:"0 0 0 0",left:"auto",top:"auto",display:"block",background:"transparent none center center"});
  9342. Klib.styles["linkscent-icon-tiny"]=Klib.merge(Klib.styles["linkscent-icon"],{width:"10px !important",height:"10px !important"});
  9343. Klib.styles.clueframe=Klib.merge(Klib.styles.clear,{left:"-2000px",top:"-2000px",display:"none",position:"fixed","z-index":"2147483647 !important",width:"400px",height:"200px"});
  9344. Klib.styles["linkscent-positioner"]=Klib.merge(Klib.styles.clear,{border:"0px solid #0f0 !important",display:"inline !important",width:"0px !important",height:"0px !important",visibility:"hidden !important"});
  9345. Klib.styles["linkscent-origin"]=Klib.merge(Klib.styles.clear,{border:"0px solid #f00 !important",position:"absolute !important",display:"block !important",top:"0px !important",left:"0px !important",width:"0px !important",height:"0px !important",visibility:"hidden !important"});
  9346. Klib.styles["linkscent-positioner-ie"]={width:"0px",border:"1px solid #f00",display:"inline-block",visibility:"visible"};
  9347. Klib.styles["interclue-main-box"]={width:"0px !important",height:"0px !important"};
  9348. Klib.styles["interclue-linkcursor"]=Klib.merge(Klib.styles.clear,{top:"-16px",left:"-16px",width:"16px !important",height:"16px !important",position:"absolute !important","z-index":"2147483646 !important",display:"none",visibility:"visible",background:"transparent none center center"});
  9349. Klib.styles["interclue-linkcursor-tiny"]=Klib.merge(Klib.styles["interclue-linkcursor"],{width:"10px !important",height:"10px !important"});
  9350. Klib.styles["interclue-clueframe-button"]={display:"-moz-inline-box"};
  9351. Klib.styles["interclue-cluebar"]=Klib.merge(Klib.styles.clear,{position:"absolute !important",display:"none",left:"0px",top:"0px","white-space":"nowrap !important",height:"26px !important",border:"1px solid #aaa !important","-moz-border-radius":"4px !important","background-color":"#eee !important"});
  9352. Klib.styles["interclue-cluebar-button"]=Klib.merge(Klib.styles.clear,{"float":"left",display:"block",margin:"2px",padding:"2px",width:"16px",height:"16px",border:"1px solid #aaa","-moz-border-radius":"4px"});
  9353. Klib.styles["interclue-cluebar-button-img"]={width:"16px",height:"16px",};
  9354. Klib.stylesheets={"clueContent.css":' *{margin:0px; padding:0px;}\n*{font-size:1em;}\nbody{font-size:69%;}\nimg{border:none;}\nbody{padding:8px 12px 8px 12px;}\n#content{}\n*{background-color:transparent; background-image:none; background-position:top left; background-repeat:no-repeat; background-attachment:scroll;}\nh1{font-size:1.1em;}\nh2{font-size:1.05em;}\nh3{font-size:1.03em;}\nh4{font-size:1.01em;}\nh5{font-size:1em;}\nh6{font-size:1em;}\na{text-decoration:none; color:#000080;}\na:hover{text-decoration:underline; color:#000080;}\na:not([href]){cursor:default;}\na:not([href]):hover{cursor:default;}\na:not([href]) img{cursor:default;}\nblockquote{padding:5px 10px 5px 10px; font-style:italic; color:#333;}\np{margin-bottom:5px;}\npre{white-space:normal;}\nli{margin:0px 0px 0px 20px;}\ninput.interclue-button{color:#000; background:#fff url("{skinUrl}/greyfade.png") repeat-x; border:1px solid #ddd; margin:2px;}\ninput.interclue-button:hover{color:#008; border:1px solid #88f;}\n.interclue-highlight{font-weight:bold; background-color:#ffffbb;}\n#interclue-unsafeWordList{color:#f00; font-weight:bold; margin-bottom:1em;}\n#interclue-loading{position:absolute; top:50%; left:50%; margin-top:-10px; margin-left:-10px;}\n.linkscent-icon{display:none;}\n.interclue-info{border:1px solid #00d; color:#00d; background:#eef url("{skinUrl}/dialogs/info.png") 3px 3px no-repeat; padding:3px 3px 3px 22px;}\n.interclue-question{border:1px solid #00d; color:#00d; background:#eef url("{skinUrl}/dialogs/question.png") 3px 3px no-repeat; padding:3px 3px 3px 22px;}\n.interclue-warning{border:1px solid #C9790E; color:#C9790E; background:#ffe url("{skinUrl}/dialogs/warning.png") 3px 3px no-repeat; padding:3px 3px 3px 22px;}\n#imagepreview-image{height:80%; padding:5px; border:1px solid #ddd; margin:5px;}\n.imagepreview-box{text-align:center;}\n.imagepreview-imagebox{min-height:130px; height:130px; overflow:visible; width:100%; text-align:center;}\n.imagepreview-imagestats, .imagepreview-message{text-align:center; color:#080;}\n.interclue-clue-error{width:100%; height:100%; background:url("{skinUrl}/clueError.png") no-repeat center center;}\n.interclue-clue-loading{width:100%; height:100%; text-align:center; background:url("{skinUrl}/linkscentLoading.gif") no-repeat center center;}\n#interclue-content-floater{border-top:1px solid #eee; border-left:1px solid #eee; border-bottom:1px solid #666; border-right:1px solid #666; font-size:0.85em; width:126px; float:right; padding:2px; margin:5px 0 5px 5px; background:#ffd; text-align:center; z-index:10; -moz-border-radius:5px; overflow:hidden;}\n.interclue-delicious-tagcloud{width:126px; overflow:hidden;}\nTABLE.interclue-delicious-tags-list{width:120px; margin:3px;}\nTABLE.interclue-delicious-tags-list .odd TD{background:#eee;}\nTABLE.interclue-delicious-tags-list .itemcount{text-align:center;}\nTABLE .textcell{text-align:left;}\nTABLE .intcell{text-align:right;}\n.interclue-content-linktypes{margin-top:4px; text-align:left;}\n.interclue-content-linktypes img{vertical-align:top; margin-top:-2px;}\n#ajaxsummariser-floater-right{position:relative; float:right; text-align:center; width:138px;}\n#interclue-thumbnail-image{background:#fff; width:120px; height:90px;}\n#interclue-thumbnail-attribution{text-align:center;}\n#interclue-header{overflow:hidden;}\n#interclue-header a{font-weight:bold;}\n.interclue-clue-infoblock{list-style-type:none; border:1px solid #080; color:#080; background:#efe; padding:3px; margin:0 0 2px 0; -moz-border-radius:5px;}\n.interclue-clue-infoblock LI{padding:0; margin:0;}\n.interclue-clue-infoblock IMG{margin:-3px 5px 0 3px; border:none; vertical-align:bottom;}\n.interclue-clue-infoblock a{text-decoration:underline;}\n#interclue-pagestats{overflow:hidden;}\n#interclue-content-text-stats, #interclue-content-resource-stats, #interclue-content-link-stats{width:120px; height:10px; display:block; margin:3px 3px 1px 3px;}\n.interclue-bargraph-bar{height:10px; font-size:10px; clear:both; position:relative;}\n.interclue-bargraph-bar-overlay{position:absolute; height:11px; width:114px; font-weight:bold; text-align:right; top:-1px; padding:0 0 0 5px;}\n.interclue-bargraph-bar-section{height:10px; float:left;}\n.interclue-bargraph-bar-section-summaryWordCount{background-color:#6b6;}\n.interclue-bargraph-bar-section-contentWordCount{background-color:#9d9;}\n.interclue-bargraph-bar-section-navWordCount{background-color:#cfc;}\n.interclue-bargraph-bar-section-linksInternal{background-color:#66b;}\n.interclue-bargraph-bar-section-linksExternal{background-color:#99d;}\n.interclue-bargraph-bar-section-linksOther{background-color:#ccf;}\n.interclue-bargraph-bar-section-images{background-color:#b6b;}\n.interclue-bargraph-bar-section-stylesheets{background-color:#d9d;}\n.interclue-bargraph-bar-section-scripts{background-color:#fcf;}\n.interclue-bargraph-bar-section-documents{background-color:#b60;}\n.interclue-bargraph-bar-section-media{background-color:#d90;}\n#interclue-tooltip-box{display:none; position:absolute; top:0px; left:0px; border:1px solid #000; padding:3px; color:InfoText; background-color:InfoBackground; width:150px; -moz-border-radius:5px;}\n.interclue-content-linktype-image{margin:1px 2px 1px 2px;}\n.interclue-summary-buttons{border:1px solid #008; background:#eef; -moz-border-radius:5px; margin:5px 0 0 0; padding:2px;}\n.interclue-summary-button{display:inline; position:relative;}\n.interclue-summary-buttons .interclue-button-image{display:inline; position:relative; width:40px; text-align:center;}\n.interclue-summary-buttons img{vertical-align:bottom; margin:0 4px 0 4px;}\n.interclue-summary-button{height:20px; white-space:nowrap;}\n.interclue-footnote{font-size:0.9em; color:#333;}\n#interclue-textsummary{border:1px solid #bbb; background-color:#f8f8f8; padding:5px; overflow:auto;}\n#interclue-textsummary pre{white-space:pre; font-family:monospace; font-size:1.1em;}\n#ajaxsummariser-framesetwarning{border:1px solid #080; color:#080; background:#efe; padding:3px; margin:0 0 2px 0; -moz-border-radius:5px;}\n#interclue-content-published-date{white-space:nowrap; text-align:center;}\n.interclue-metadata-published-days{color:#009900;}\n.interclue-metadata-published-weeks{color:#669900;}\n.interclue-metadata-published-months{color:#999900;}\n.interclue-metadata-published-years{color:#996600;}\n.metadata-block-3rd-party .metadata-title{font-style:italic;}\n.metadata-block-destination .metadata-title, .metadata-block-destination .metadata-content{background-color:#FFDD99;}\n.metadata-block-disabled .metadata-title, .metadata-block-disabled .metadata-content{background-color:transparent;}\n.metadata-title h3{white-space:nowrap;}\n.interclue-content-linktypes h4{margin:0 0 3px 0;}\n#metadata-feeds-block{text-align:left;}\n#interclue-thumbnail-tooltip-heading{text-align:center;}\n#imagepreview-filesize{font-size:1.1em;}\n.metadata-block{background:url(\'{skinUrl}/metadata/background.png\') no-repeat; margin-bottom:4px;}\n.metadata-block h3{height:18px; padding:3px 0 1px 0; font-size:1.1em; text-align:left;}\n.metadata-block h3 img{margin:0 1px 0 1px; vertical-align:bottom;}\n.metadata-block .toggle, .metadata-block .metadata-close-button{float:right; margin:0 1px 0 1px; padding:0 0 0 0;}\n.metadata-block{text-align:left;}\n.metadata-block-disabled{-moz-opacity:0.4; opacity:0.4;}\n.metadata-block-disabled h3{height:14px; padding:3px 0 1px 0; font-size:0.9em;}\n#metadata-delicious-block{text-align:center;}\n#metadata-digg-block{text-align:center;}\n#metadata-downloadablefiles-list{width:100%;}\n#metadata-downloadablefiles-list td{padding:0 1px 0 1px;}\n#metadata-downloadablefiles-list a{display:block; overflow:hidden;}\n.metadata-footer, .metadata-footer a{text-align:center; color:#88f;}\n#metadata-more{line-height:18px; padding:3px 0 0 0; text-align:center;}\n#interclue-footer{clear:both;}\n.interclue-faviconlink, .interclue-faviconlink img{width:16px; height:16px; margin:0 5px 0 0; border:0px; vertical-align:middle;}\n#interclue-qfs-block{margin-top:15px;}\n#interclue-mp3-summary{text-align:center;}\nIMG.summary-image{margin:2px 0 2px 0;}\nIMG.summary-image-thumbnail, A IMG.summary-image-thumbnail{margin:2px 0 2px 0; cursor:-moz-zoom-in;}\nIMG.summary-image-known-size{background:url("{skinUrl}/imageLoading.png") no-repeat center center;}\ndiv [name="flashContentDiv"]{display:none;}\n@media print{.interclue-clue-infoblock, .metadata-title .toggle, #metadata-more{display:none;}\n}\nDIV.summary-image-block{overflow:auto;}\nDIV.summary-image-block IMG{margin:2px; display:inline;}\nIMG.interclue-placeholder{display:none;}\n.interclue-message-block{margin-top:10px; padding:6px; -moz-border-radius:8px; border:1px solid #008; background:#e8e8ff;}\n.interclue-message-block a{text-decoration:underline;}\n.unsafeurl-buttons-block{text-align:center;}\n.unsafeurl-buttons-block .interclue-button{display:block; width:250px; text-align:center; margin:5px 0 5px 0;}\n#interclue-thumbnail-image-box{border-top:1px solid #ddf; border-left:1px solid #ddf; border-bottom:1px solid #ddf; border-right:1px solid #ddf; background-color:#fff; margin:2px; width:120px; height:90px; text-align:center; line-height:90px;}\n#interclue-thumbnail-image-box IMG{vertical-align:middle;}\nIFRAME#ajaxsummariser-whole-page{background:#fff no-repeat center center;}\n#ajaxsummariser-whole-page-div li{display:inline;}\n.ajaxsummariser-paragraph-break{height:20px; visibility:hidden;}\n#unsafe-form{margin:20px;}\n#unsafe-form .radio, #unsafe-form .checkbox{margin:0px 5px;}\n#unsafe-form label{font-weight:bold; margin-right:10px;}\n.unsafe-footnote{color:#666;}\n#unsafe-domain{font-weight:bold; color:#d00;}\n.interclue-form-field{margin-top:5px; margin-bottom:10px;}\n#unsafe-form .interclue-button{min-width:200px;}\n#unsafe-form .interclue-button-description{color:#666;}\n#unsafe-form .disclaimer{font-size:85%; color:#666;}\n.unsafe-querystring{color:#00d; font-weight:bold;}\n#unsafe-url{padding:10px; font-weight:bold;}\n.unsafeurl-highlight-unsafe-word{color:#f00; font-weight:bold;}\n#interclue-textsummary{text-align:left;}\n',"clueContent.ie.css":" .interclue-bargraph-bar-overlay{position:absolute; height:11px; width:114px; font-weight:bold; text-align:right; top:-1px; padding:0 0 0 5px;}\n","clueFrame.css":' *{margin:0px; padding:0px;}\np{margin-top:0.7em; margin-bottom:0.7em;}\n*{font-size:1em; font-family:arial, helvetica, sans-serif;}\nbody{font-size:76%;}\nimg{border:none;}\nul, ol{list-style:none;}\n*{background-color:transparent; background-image:none; background-position:top left; background-repeat:no-repeat; background-attachment:scroll;}\n#titlebar, #titlebar-right{height:24px;}\n#titlebar-right{position:absolute; top:0px; right:0px; padding:0 0 0 0; height:24px;}\n#toolbar{display:none; position:absolute; top:0px; left:0px; height:22px;}\n#secondary-toolbar{display:none;}\n#secondary-toolbar .button_right{display:none; position:relative; float:right;}\n#contentFrame{top:0px; left:0px; width:100%; height:100%;}\n#statusbar{position:absolute; height:15px; border:1px solid; left:0px; right:0px; bottom:0px;}\n#dropshadow{display:none;}\n#loading{display:none;}\n#content, #interclue-loading-overlay{position:absolute; top:24px; left:0px; bottom:16px; right:0px;}\n#interclue-loading-overlay{display:none; background:url("{skinUrl}/overlay.png"); text-align:center;}\n#interclue-loading-image{position:absolute; top:0px; left:0px; bottom:0px; right:0px; background:url("{skinUrl}/loading-large.gif") no-repeat center center;}\n.clueiframe #container{position:absolute; top:0px; left:0px; right:7px; bottom:7px;}\n.clueiframe #dropshadow{display:block; position:absolute; top:7px; left:7px; width:100%; height:100%; z-index:-1;}\n#container{border:1px solid #94A5B5;}\n#content{background:#fff url("{skinUrl}/background.png") repeat-y right;}\n#titlebar{overflow:hidden; background:#3D5A95 url("{skinUrl}/titlebarFade.png") no-repeat right; text-align:left;}\n.interclue-locked #titlebar{background:#3D955A url("{skinUrl}/titlebarFade.png") no-repeat right;}\n#loading{display:none;}\n#statusbar{line-height:15px; font-size:11px; overflow:hidden; background-color:#D4D0C8; padding-left:5px; border:none; border-top:1px solid #94A5B5;}\nSPAN.toolbarbutton{margin:1px 1px 1px 1px; border:1px solid #008; background:#eee; cursor:default; display:-moz-inline-box; overflow:auto; -moz-border-radius:4px;}\n.toolbarbutton:hover{border:1px solid #0cc; background-color:#fff;}\n.toolbarbutton-down{border:1px solid #0ff; background-color:#ccf;}\n.toolbarbutton IMG{margin:2px; border:0px;}\n#resizehandle{position:absolute; display:block; width:16px; height:16px; bottom:0px; right:0px; background:url("{skinUrl}/sprites.png") no-repeat -32px -48px; cursor:nw-resize;}\n.clueiframe #statusbar{-moz-border-radius:0px 0px 6px 6px;}\n.clueiframe #titlebar{-moz-border-radius:6px 6px 0px 0px;}\n.clueiframe #container{-moz-border-radius:8px;}\n.error{border:1px solid #f00; color:#f00; background:#fee url("{skinUrl}/dialogs/error.png") 3px 3px no-repeat; padding:3px 3px 3px 22px;}\n.info{border:1px solid #008; color:#008; background:#eef url("{skinUrl}/dialogs/info.png") 3px 3px no-repeat; padding:3px 3px 3px 22px;}\n.warning{border:1px solid #C9790E; color:#C9790E; background:#ffe url("{skinUrl}/dialogs/warning.png") 3px 3px no-repeat; padding:3px 3px 3px 22px;}\n.updated{border:1px solid #060; color:#060; background:#efe url("{skinUrl}/dialogs/updated.png") 3px 3px no-repeat; padding:3px 3px 3px 22px;}\n#alert{display:none; padding:25px; position:absolute; top:0px; left:0px; bottom:7px; right:7px; z-index:10000; text-align:center; vertical-align:middle; background:url("{skinUrl}/overlay.png"); border:1px solid #000; -moz-border-radius:8px;}\n#alert-box{position:relative; min-width:80%; min-height:80%; border:1px solid #000; -moz-border-radius:5px; background-color:#fbfbfb; padding-bottom:10px;}\n#alert-title{background:#3D5A95; color:#fff; font-weight:bold; font-size:1.3em; border-bottom:1px solid #333;}\n#alert-message{margin:1em 32px 1em 32px; text-align:left;}\n#alert-close{position:absolute; top:2px; right:2px; background:#eef url("{skinUrl}/close.png") center center no-repeat; min-width:16px; min-height:16px; cursor:default;}\n#alert-dont-show-again-label{display:block; font-size:smaller;}\n.alert-error #alert-title{color:#f00; background:#fee url("{skinUrl}/dialogs/error.png") 2px 3px no-repeat; border-bottom:1px solid #f00}\n.alert-warning #alert-title{color:#C9790E; background:#ffe url("{skinUrl}/dialogs/warning.png") 2px 3px no-repeat; border-bottom:1px solid #C9790E;}\n.alert-update #alert-title{color:#080; background:#efe url("{skinUrl}/dialogs/updated.png") 2px 3px no-repeat; border-bottom:1px solid #080;}\n.alert-message #alert-title{color:#00f; background:#eef url("{skinUrl}/dialogs/info.png") 2px 3px no-repeat; border-bottom:1px solid #00f;}\n#logo{text-align:right; line-height:15px; font-size:11px;}\n#donate-link{color:#00f; text-decoration:underline; cursor:pointer;}\n#donate-link:hover{color:#33f; text-decoration:underline;}\n.clueiframe #logo{position:absolute; bottom:8px; right:18px;}\nIMG#summary-view-image-full-sized{cursor:-moz-zoom-out;}\n#alert-button-ok, alert-button-cancel{width:80px; margin:8px;}\n',"clueFrame.ie.css":" html, body{height:100%;}\n#container{width:97%; height:97%; padding:0; margin:0; background-color:#D4D0C8;}\n#statusbar{width:100%; bottom:0px;}\n#content{width:100%; height:expression((this.offsetParent.offsetHeight-41)+'px');}\n#contentFrame{top:0px; left:0px; width:100%; height:expression((this.offsetParent.offsetHeight-41)+'px');}\n#alert{width:100%; height:100%; top:0; left:0;}\n#alert-close{width:20px; height:20px;}\nDIV#titlebar-right{height:24px; margin:0 0 0 0;}\nA.toolbarbutton{margin:1px 1px 1px 1px; padding:2px; border:1px solid red;}\nA.toolbarbutton IMG{margin:4px 0 0 0;}\n","reset.css":" *{margin:0px; padding:0px;}\n*{font-size:1em; font-family:verdana, arial, helvetica, sans-serif;}\nbody{font-size:76%;}\nimg{border:none;}\n.navigation ul, .navigation ol{list-style:none ;}\n","bugreporter.css":' body{overflow:hidden;}\nform{padding:0; height:97%;}\n.container{height:100%;}\nh3{margin:10px 0px 2px 0px; padding-left:5px;}\na{color:#008;}\nbody{margin:0; font-family:"Trebuchet MS", Arial, Verdana; font-size:0.74em; color:#000; background-color:#FFFFFF;}\n.textbox, .textarea{width:480px;}\n.textarea{height:45px;}\n#FeatureRequest-comments, #SuggestImprovement-comments{height:135px;}\n#Other-comments{height:90px;}\n.form-field .error{border:1px solid #d00; background:#fee; color:#d00;}\n#debuglog-preview{font-size:12px; font-weight:normal; border:1px solid #333; background:#eee; overflow-x:auto; color:#333;}\n.problem-fields{display:none; border:1px solid #080; background:#efe; -moz-border-radius:5px; padding:5px; margin:0px 5px 5px 50px;}\ninput.disabled, input.disabled:hover{color:#bbb; border:1px solid #bbb;}\n.form-field-description{margin-left:30px; margin-right:30px;}\n.bugreporter-form label{font-weight:bold;}\nlabel.radio-label{font-weight:normal;}\n#status-messages{height:1.5em; text-align:left; padding:0 0 0 20px; font-size:0.9em; line-height:1.5em; float:left; margin:0 0 0 5px; font-weight:normal; max-width:50%;}\n#status-messages.info{background:url({skinUrl}/info.png) no-repeat left center; color:#008;}\n#status-messages.loading{background:url({skinUrl}/loading.gif) no-repeat left center; color:#880;}\n#status-messages.success{background:url({skinUrl}/success.png) no-repeat left center; color:#080;}\n#status-messages.error{font-weight:bold; background:url({skinUrl}/error.png) no-repeat left center; color:#d00;}\n.button{width:80px; margin:0 5px 0 0; text-align:center;}\n#bugreporter-report-viewer{display:none; position:absolute; top:0px; bottom:0px; left:0px; right:0px; background:#999;}\n#bugreporter-report-preview{position:absolute; margin:1.5%; padding:1%; width:94%; height:89%; background:#eee; color:#333;}\n#translation-tab-title{display:none;}\n#translation-tab-panel{display:none;}\n#Translation-fields .textarea{width:480px; height:100px;}\n.bugreporter-page .emailbox{width:200px;}\n.optional{font-weight:normal; color:#333;}\n#other-problems-box{max-height:94%; overflow:auto;}\n',"bugreporter.ie.css":" #bugreporter-report-viewer{width:100%; height:100%;}\n#bugreporter-report-preview{top:3%; left:3%; width:94%; height:87%;}\n","dialog.css":' body, html{width:100%; height:100%;}\nbody{overflow-x:hidden;}\nbody{margin:0 0 0 0; padding:0 0 0 0; font-family:"Trebuchet MS", Arial, Verdana; font-size:0.74em; color:#000; background-color:#FFFFFF;}\nform{border:1px solid #880; -moz-border-radius:5px;}\n.form-field{padding:3px;}\nLABEL{color:#000;}\n.form-field label{display:block;}\n.form-field-description{font-size:0.9em; color:#333;}\n.intbox, .emailbox, .textbox, .password, .textarea, .selectbox{border:1px solid #bbb;}\n.checkbox, .radio{border:none;}\n.intbox:focus, .emailbox:focus, .password:focus, .textbox:focus, .textarea:focus{border:1px solid #88f; color:#00f;}\nINPUT.intbox{width:40px; text-align:right;}\n.error .password, .error .textbox, .error .textarea{border:1px solid #f00; color:#f00;}\n.form-field-required{font-weight:bold; color:#f00;}\n.form-field-info{border:1px solid #880; background:#ffe; padding:5px; margin:10px 10px 10px 20px; -moz-border-radius:6px;}\n.form-field-info em{font-weight:bold;}\ndiv#overlay{position:absolute; display:block; top:0px; left:0px; width:100%; height:100%; background:#fff url("{skinUrl}/../background.png") repeat-y right; text-align:center; z-index:1;}\nimg#loading{position:relative; width:16px; height:16px; top:47%;}\ninput.button{color:#000; background:#fff url("{skinUrl}/../greyfade.png") repeat-x; border:1px solid #ddd; -moz-border-radius:4px;}\ninput.button:hover{color:#008; background:#fff; border:1px solid #88f;}\n#donate-block{position:absolute; top:5px; right:5px;}\n.button-large{display:block; float:left; margin:20px; width:200px; height:140px; text-align:center; line-height:70px; white-space:nowrap; color:#ffffff; text-decoration:none; font-size:22px; font-weight:bold; background:url("{skinUrl}/button-green-large.png") no-repeat; background-position:0px 0px;}\n.button-large:hover{background-position:-200px 0px;}\n#contribute-tab-panel .description{margin:0 20px 0 20px; font-size:1.1em;}\n#interclue-preferences-dialog #contribute-tab-panel .description{font-size:1.0em;}\n#contribute-buttons{text-align:center; margin-left:auto; margin-right:auto; overflow:auto; width:480px;}\n',"login.css":' *{margin:0px; padding:0px;}\n*{font-size:1em; font-family:Arial, Helvetica, Sans-serif;}\nbody{font-size:79%;}\nimg{border:none;}\nbody{background-color:#eef;}\n#form-login{padding:4px;}\n#form-login h1{border:1px solid #880; background:#ffe url("{skinUrl}/login.png") no-repeat 3px center; height:1.5em; text-align:center; -moz-border-radius:5px; font-size:1.3em; line-height:1.5em;}\n#form-login frameset{margin:5px 0 0 0; -moz-border-radius:5px;}\n#form-login label{width:90px; float:left; text-align:right; padding-right:3px;}\n#form-login .form-field{margin-top:5px; height:25px;}\n#form-login .textbox, #form-login .passwordbox{float:left; width:175px; border:1px solid #94A5B5; -moz-border-radius:5px;}\n#form-login .form-buttons{padding-left:96px;}\n#form-login .button{float:left; border:1px solid #666; background-color:#eee; width:85px; margin-right:5px; -moz-border-radius:5px;}\n#form-login #status-messages{height:1.5em; text-align:left; padding:0 0 0 1em; -moz-border-radius:5px; font-size:0.9em; line-height:1.5em;}\n.status-error{font-weight:bold; border:1px solid #d00; background:#fee url("{skinUrl}/error.png") no-repeat right center; color:#d00;}\n.status-loading{font-weight:normal; border:1px solid #080; background:#efe url("{skinUrl}/loading.gif") no-repeat right center; color:#080;}\n.status-normal{font-weight:normal; border:1px solid #080; background:#efe none no-repeat right center; color:#080;}\ndiv#overlay{position:absolute; display:block; top:0px; left:0px; width:100%; height:100%; background:#fff url("{skinUrl}/../background.png") repeat-y right; text-align:center; z-index:1;}\nimg#loading{position:relative; width:16px; height:16px; top:47%;}\n',"preferences.css":' body, html{width:100%; height:100%;}\nbody{overflow:hidden;}\nform{height:97%;}\nh3{margin:10px 0px 2px 0px; padding-left:5px; border-bottom:1px solid #776655;}\na{color:#008;}\nbody{margin:0; font-family:"Trebuchet MS", Arial, Verdana; font-size:0.74em; color:#000;}\nform{}\n.disabled{color:#888;}\n.optgroup-description em{color:#666; font-weight:normal;}\nfieldset{position:absolute; display:block; visibility:hidden; top:0px; left:0px; width:510px; height:410px;}\n.fieldset-panel{overflow-x:hidden; overflow-y:auto; top:0px; left:0px; display:block; height:400px; width:510px;}\n#ClueFrame-hotKey{text-align:center;}\n#selector{position:absolute; top:5px; left:5px; height:auto; width:150px;}\n#pref-list{position:absolute; top:7px; left:3px; width:130px; height:420px; border:1px solid #ddd; font-size:0.9em;}\n#panels{position:absolute; top:5px; left:150px; display:block; height:auto; width:510px;}\n#Admin-panel{background-color:#fee;}\n#interclue-preferencesdialog-unsafe-wordlist{color:#800;}\n#interclue-preferencesdialog-checkforupdates, #interclue-preferencesdialog-resetpersiterules{margin:0 0 0 40px;}\n.form-field{-moz-border-radius:5px; padding:3px 3px 10px 3px;}\n.form-field label{display:inline; font-weight:bold; color:#000; text-align:left; padding:0 4px 0 20px;}\n#basic-tab .form-field-optgroup label{font-weight:normal; padding:0 4px 0 4px; color:inherit;}\n.datatable label{display:block; font-weight:normal; text-align:left; padding:0 4px 0 20px;}\n.form-field .textarea{display:block; margin:0 0 0 40px; width:350px; height:100px;}\n.form-field .textarea-smaller{height:60px;}\n.form-field .checkbox, .form-field .textbox, .form-field .selectbox, .form-field .intbox{display:inline; margin:0 0 4px 0;}\n.form-field .intbox{display:inline; margin:0 0 0 0px;}\n.form-field .form-field-description{display:block; padding:0 0 0 20px;}\n.form-field-optgroup LABEL{font-weight:normal;}\n#basic-tab .form-field-optgroup{border:none;}\n#changelog-iframe{width:99%; margin:20px 0 0 0; border:1px solid #88f; height:250px; background-color:#fff;}\n.form-field-radio-option label{display:inline;}\n.form-field-radio-option .radio{display:inline; margin:0 0 0 20px;}\n.form-field-radio-option{margin:5px 0 5px 0;}\ntable.datatable tbody th{text-align:left; width:150px; height:2em;}\ntable.datatable{border:1px solid #87CEFA; border-bottom:0px solid #87CEFA; width:100%; margin:0 0 10px 0;}\ntable.datatable tbody th{text-align:left; padding:0 0 0 5px;}\ntable.datatable thead th, table.datatable .thead th{text-align:center; padding:0 5px 0 5px; color:#fff; border-left:1px solid #87CEFA; background:#3399dd;}\ntable.datatable td, table.datatable th{border-bottom:1px solid #87CEFA;}\ntable.datatable td{text-align:center;}\ntable.datatable tr.even{background:#F0F8FF;}\ntable.datatable tr.odd{background:#fff;}\ntable.datatable tbody tr:hover{background-color:#eff;}\n#interclue-preferencesdialog-custombuttons .custombutton-image{margin-left:8px; margin-right:8px;}\n#preferences-buttons-table td{text-align:left;}\n#interclue-preferencesdialog-security-rules-table td{text-align:left;}\n#interclue-preferencesdialog-security-rules-table td.securitylogic{text-align:center;}\n#interclue-preferencesdialog-roi-income{text-align:right;}\n#security-rules-textbox-rule{width:98%;}\n#security-rules-selectbox, #security-rules-selectbox option{text-align:right;}\n#reset-options{margin:10px; border:1px solid #DAE0D2; background:#eef; padding:5px; -moz-border-radius:5px;}\n#button-reset{margin:15px; width:100px;}\n.reset-option label{font-weight:normal;}\n.metadata-3rd-party{background:#fec;}\n.form-field-notes{margin-top:5px; padding:10px; -moz-border-radius:5px; background:#eef;}\n#interclue-preferences-about-block{margin:0 20px 0 20px;}\n#interclue-preferences-terms-iframe{margin:10px 0 10px 0; width:100%; background:#fff; height:160px;}\n#donate-block{position:absolute; top:5px; right:5px;}\n#button-donate{width:87px; height:30px; background:url("{skinUrl}/donate.png") no-repeat;}\n#button-donate:hover{background:url("{skinUrl}/donate_hover.png") no-repeat;}\n#interclue-preferencesdialog-buttons img, #interclue-preferencesdialog-statusbar-buttons img{margin-top:2px; margin-bottom:-2px;}\n#interclue-preferences-about-block address{float:right; width:200px;}\n#interclue-preferences-about-block .links{text-align:center;}\n#interclue-preferencesdialog-statusbar-buttons-block .td-icon, #interclue-preferencesdialog-statusbar-buttons-block .td-checkbox{width:32px; text-align:center;}\n#interclue-preferencesdialog-statusbar-buttons-block .td-text-main{text-align:left; width:100%;}\n#interclue-preferencesdialog-statusbar-buttons-block img{margin-left:6px; margin-right:6px;}\n#clueframe-prefs-font{position:relative;}\n#ClueFrame-sample{float:right; width:235px; height:150px; overflow:auto; background:#fff url(\'{skinUrl}/../background.png\') repeat-y top right; border:1px solid #87CEFA; -moz-border-radius:5px; padding:5px; margin:5px;}\n.clear-floats{clear:both;}\nOPTION.heading{border-bottom:1px dotted #ddd; color:#666; font-style:italic; text-align:center; padding-top:10px; margin-bottom:5px;}\n#contribute-tab-panel .form-field-description{margin-left:15px; margin-right:15px;}\n#link-reset-messages{padding-left:20px;}\n',"preferences.ie.css":" fieldset{width:490px; height:380px;}\n.fieldset-panel{margin:-5px 0 0 0; width:489px; height:368px;}\ntable.datatable{width:95%;}\n#selector{position:absolute; top:5px; left:5px; height:auto; width:150px;}\n#pref-list{margin:8px 10px 0 5px; position:static; float:left; width:130px; height:390px; font-size:1em;}\n#panels{position:absolute; top:2px; left:150px; display:block; height:490px; width:510px;}\n","tutorial.css":' *{font-family:"Trebuchet MS", Arial, Verdana; font-size:1em;}\nbody{width:100%; height:100%; display:table;}\na{color:#00f;}\na:visited{color:#00f;}\na.disabled{color:#999; text-decoration:none;}\na.disabled:hover{text-decoration:none;}\n#layout{display:table-cell; vertical-align:top; text-align:center;}\n#container{margin:10px auto 0 auto; position:relative; width:800px; height:550px; border:1px solid #660; color:#660; background:#ffe; -moz-border-radius:8px;}\n#menu{margin:10px auto 0 auto; position:absolute; left:10px; width:160px; height:530px; border:1px solid #666; color:#333; background:#e8e8e8; -moz-border-radius:8px; text-align:left;}\n#menu ul, #menu ul li{padding:0px; margin:0px;}\n#menu li{list-style-type:none;}\n#menu a{color:#333; border-bottom:1px solid #fff; display:block; padding:2px 5px 2px 5px; font-size:1.1em; text-decoration:none;}\n#menu a#menulink-welcome{-moz-border-radius-topleft:8px; -moz-border-radius-topright:8px;}\n#menu a.selected{background-color:#efe; color:#000;}\n#menu a:hover{background-color:#efe;}\n#content{font-size:1.2em; position:absolute; top:310px; left:185px; text-align:left; width:605px;}\n#instructions{font-size:1.2em; position:absolute; top:10px; left:185px; width:605px; height:80px;}\n#title{border:1px solid #040; color:#040; background:#efe url("{skinUrl}/../interclue24.png") no-repeat 5px center; padding:5px 27px 5px 27px; margin:0 0 10px 0; text-align:center; -moz-border-radius:5px; opacity:0;}\n#info{border:1px solid #040; color:#040; background:#efe; padding:5px; margin:0 0 10px 0; text-align:left; -moz-border-radius:5px; opacity:0;}\n#instruc{background:#fee url("{skinUrl}/lightbulb.png") no-repeat 5px center; padding:5px 5px 5px 25px; border:1px solid #d00; color:#d00; margin:0 0 10px 0; font-weight:bold; text-align:left; opacity:0; -moz-border-radius:5px;}\n#instruc a{color:#d00; text-decoration:none;}\n#instruc a:hover{color:#d00; text-decoration:underline;}\n#content{opacity:0; margin-left:10px;}\n#content a{font-weight:bold;}\n#tutorial-cursors-links-list li{margin:5px;}\n.interclue-tutorial-screenshot{margin-bottom:-5px;}\na.google-title{font-family:arial,sans-serif; font-size:82%; color:#00c; margin:0; padding:0;}\nspan.google-url{color:#080;}\ndiv.google-description{font-size:70%; color:#000;}\n.google-info{font-size:70%;}\na.google-other{color:#7777CC;}\n.google-search-result{margin:15px 0 15px 0;}\n',"tabs.css":' .tab{font-size:1.3em;}\n.tab-bar{float:left; width:100%; background:#DAE0D2 url("{skinUrl}/bg.png") repeat-x bottom; font-size:93%; line-height:normal;}\n.tab-bar{margin:0; padding:10px 10px 0; list-style:none;}\n.tab-bar li{float:left; background:url("{skinUrl}/left.png") no-repeat left top; margin:0; padding:0 0 0 9px;}\n.tab-bar span{float:left; display:block; background:url("{skinUrl}/right.png") no-repeat right top; padding:5px 15px 4px 6px; text-decoration:none; font-weight:bold; color:#765;}\n.tab-bar span{float:none;}\n.tab-bar span:hover{color:#333;}\n.tab-bar .tab-selected{background-image:url("{skinUrl}/left_on.png"); border-width:0;}\n.tab-bar .tab-selected span{background-image:url("{skinUrl}/right_on.png"); color:#333; padding-bottom:5px;}\n.tab-panel{position:absolute; top:38px; background:#DDE3D5 url("{skinUrl}/white-green-fade.png") repeat-x; width:100%; bottom:27px; overflow:hidden;}\n.footer{position:absolute; bottom:0px; left:0px; width:100%; text-align:right; height:20px; padding:5px 0 2px 0; background:#DAE0D2 url("{skinUrl}/footer.png") repeat-x top;}\n.footer .button{margin:0 5px 0 5px; width:85px; text-align:center;}\n#basic-tab{}\n',"tabs.ie.css":".tab-bar{width:99%;}\n.tab-bar .tab-selected{border-width:0; border:0px;}\n.tab-panel{width:99.9%; height:90%;}\n"};
  9355. if(Klib.install("Toolbar",0.1)){Klib.Toolbar.buttonIds=["currentpage","referrerpage","tutorial","options","changelog","bugreport","visitwebsite","stats","buttonload","donate","updatecheck","about"];
  9356. Klib.Toolbar.getDoc=function(){throw Error("Platform -> Klib.Toolbar.getDoc")
  9357. };
  9358. Klib.Toolbar.show=function(H,F,D,G){var E=Klib.Toolbar.getDoc();
  9359. if(E){var B=$(H,E);
  9360. if(B){if(Klib.platform=="firefox"){B.hidden=!F;
  9361. if(D!==undefined){B.setAttribute("tooltiptext",D)
  9362. }}else{B.style.display=(F)?"block":"none";
  9363. if(D!==undefined){B.title=D;
  9364. B.alt=D
  9365. }}}else{if(H=="interclue-statusbarbox-main"&&Klib.platform=="IEToolbar"){var C=Klib.getEles("td.interclue-statusbarbox-main",E);
  9366. for(var A=0;
  9367. A<C.length;
  9368. A++){Klib.Toolbar.show(C[A],F,D)
  9369. }}else{if(!G){}}}}};
  9370. Klib.Toolbar.statusClear=function(){var B=Klib.Toolbar.getDoc();
  9371. if(B){var A=$("interclue-statusbar",B);
  9372. Klib.replaceClass(A,"interclue-statusbar-error,interclue-statusbar-warning,interclue-statusbar-message","interclue-statusbar-message");
  9373. A.value=""
  9374. }};
  9375. Klib.Toolbar.status=function(E,A,C){var D=Klib.Toolbar.getDoc();
  9376. if(D){var B=$("interclue-statusbar",D);
  9377. A=A||"message";
  9378. Klib.replaceClass(B,"interclue-statusbar-error,interclue-statusbar-warning,interclue-statusbar-message","interclue-statusbar-"+A);
  9379. B.value=E;
  9380. if(C===undefined){C=3000
  9381. }if(C){Klib.setNamedTimer("Klib.Toolbar.statusClear",Klib.Toolbar.statusClear,C)
  9382. }}};
  9383. Klib.Toolbar.refresh=function(){var I=(arguments&&arguments[0]&&arguments[0].URL)?arguments[0]:Klib.ClueBridge.sourceDoc;
  9384. Klib.Toolbar.lastDoc=I;
  9385. var H=Klib.Global.get("loggedIn",false);
  9386. Klib.Toolbar.show("interclue-state-loading-statusbarbutton",false);
  9387. Klib.Toolbar.show("interclue-statusbarbox-main",H);
  9388. var A="";
  9389. if(H&&I&&Klib.Security.isDocEnabled(I)){A="enabled"
  9390. }else{if(H){A="disabled-for-domain"
  9391. }else{if(Klib.Pref.get("User.loginAtStartUp")){A="disabled-until-restart"
  9392. }else{A="disabled"
  9393. }}}Klib.Toolbar.show("interclue-state-enabled-statusbar-button",A=="enabled");
  9394. Klib.Toolbar.show("interclue-state-disabled-for-domain-statusbar-button",A=="disabled-for-domain");
  9395. Klib.Toolbar.show("interclue-state-disabled-until-restart-statusbar-button",A=="disabled-until-restart");
  9396. Klib.Toolbar.show("interclue-state-disabled-statusbar-button",A=="disabled");
  9397. Klib.Toolbar.updateInterclueMenu(A);
  9398. Klib.Toolbar.show("interclue-buttoneditor-statusbar-menuitem",Klib.Pref.get("CustomButtons.enabled"),false);
  9399. Klib.Toolbar.show("interclue-buttonload-statusbar-menuitem",Klib.Pref.get("CustomButtons.enabled")&&Klib.CustomButtons.isValidCustomButtonDoc(I),false);
  9400. if(top&&top.interclue&&top.interclue.isSiteHound){var F=Klib.Pref.get("Clues.enabled");
  9401. Klib.Toolbar.show("interclue-sitehound-previews-disable-statusbar-button",F,"",true);
  9402. Klib.Toolbar.show("interclue-sitehound-previews-enable-statusbar-button",!F,"",true)
  9403. }else{Klib.Toolbar.show("interclue-sitehound-previews-disable-statusbar-button",false,"",true);
  9404. Klib.Toolbar.show("interclue-sitehound-previews-enable-statusbar-button",false,"",true)
  9405. }var B=Klib.Pref.get("Update.versions");
  9406. if(B&&Klib.Pref.get("Update.notifyUser",true)){var C=(Klib.Pref.get("Update.check.nightly")&&B.nightly&&B.nightly.build>Klib.App.build);
  9407. var E=(!C&&Klib.Pref.get("Update.check.experimental")&&B.experimental&&B.experimental.build>Klib.App.build);
  9408. var G=(!C&&Klib.Pref.get("Update.check.beta")&&B.beta&&B.beta.build>Klib.App.build);
  9409. var D=(!C&&!E&&!G&&Klib.Pref.get("Update.check.stable")&&B.stable&&B.stable.build>Klib.App.build);
  9410. Klib.Toolbar.show("interclue-updatenightlyavailable-statusbar-button",C);
  9411. Klib.Toolbar.show("interclue-updateexperimentalavailable-statusbar-button",E);
  9412. Klib.Toolbar.show("interclue-updatebetaavailable-statusbar-button",G);
  9413. Klib.Toolbar.show("interclue-updateavailable-statusbar-button",D)
  9414. }else{Klib.Toolbar.show("interclue-updatenightlyavailable-statusbar-button",false);
  9415. Klib.Toolbar.show("interclue-updateexperimentalavailable-statusbar-button",false);
  9416. Klib.Toolbar.show("interclue-updatebetaavailable-statusbar-button",false);
  9417. Klib.Toolbar.show("interclue-updateavailable-statusbar-button",false)
  9418. }Klib.Toolbar.show("interclue-bugreport-statusbar-button",H&&(Klib.Pref.get("ToolbarButton.bugreport.location")=="statusbar"));
  9419. Klib.Toolbar.show("interclue-bugreport-statusbar-menuitem",H&&(Klib.Pref.get("ToolbarButton.bugreport.location")=="statusbarmenu"));
  9420. if(I&&I.referrer){Klib.Toolbar.show("interclue-referrerpage-statusbar-button",H&&(Klib.Pref.get("ToolbarButton.referrerpage.location")=="statusbar"));
  9421. Klib.Toolbar.show("interclue-referrerpage-statusbar-menuitem",H&&(Klib.Pref.get("ToolbarButton.referrerpage.location")=="statusbarmenu"));
  9422. Klib.Toolbar.show("interclue-referrerpagedisabled-statusbar-button",false);
  9423. Klib.Toolbar.show("interclue-referrerpagedisabled-statusbar-menuitem",false)
  9424. }else{Klib.Toolbar.show("interclue-referrerpagedisabled-statusbar-button",H&&(Klib.Pref.get("ToolbarButton.referrerpage.location")=="statusbar"));
  9425. Klib.Toolbar.show("interclue-referrerpagedisabled-statusbar-menuitem",H&&(Klib.Pref.get("ToolbarButton.referrerpage.location")=="statusbarmenu"));
  9426. Klib.Toolbar.show("interclue-referrerpage-statusbar-button",false);
  9427. Klib.Toolbar.show("interclue-referrerpage-statusbar-menuitem",false)
  9428. }Klib.Toolbar.show("interclue-currentpage-statusbar-button",H&&(Klib.Pref.get("ToolbarButton.currentpage.location")=="statusbar"));
  9429. Klib.Toolbar.show("interclue-currentpage-statusbar-menuitem",H&&(Klib.Pref.get("ToolbarButton.currentpage.location")=="statusbarmenu"));
  9430. Klib.Toolbar.show("interclue-clearcache-statusbar-button",top.interclue.getPref("interclue.showClearCache",false));
  9431. Klib.Toolbar.show("interclue-debuglog-statusbar-button",top.interclue.getPref("interclue.showDebugLog",false))
  9432. };
  9433. Klib.Toolbar.updateInterclueMenu=function(A){var B=Klib.Toolbar.getDoc();
  9434. if(B){if(A=="enabled"){Klib.addClass($("interclue-menuitem-state-enable",B),"interclue-selected");
  9435. Klib.removeClass($("interclue-menuitem-state-disablefordomain",B),"interclue-selected");
  9436. Klib.removeClass($("interclue-menuitem-state-disableuntilrestart",B),"interclue-selected");
  9437. Klib.removeClass($("interclue-menuitem-state-disable",B),"interclue-selected")
  9438. }else{if(A=="disabled-for-domain"){Klib.removeClass($("interclue-menuitem-state-enable",B),"interclue-selected");
  9439. Klib.addClass($("interclue-menuitem-state-disablefordomain",B),"interclue-selected");
  9440. Klib.removeClass($("interclue-menuitem-state-disableuntilrestart",B),"interclue-selected");
  9441. Klib.removeClass($("interclue-menuitem-state-disable",B),"interclue-selected")
  9442. }else{if(A=="disabled-until-restart"){Klib.removeClass($("interclue-menuitem-state-enable",B),"interclue-selected");
  9443. Klib.removeClass($("interclue-menuitem-state-disablefordomain",B),"interclue-selected");
  9444. Klib.addClass($("interclue-menuitem-state-disableuntilrestart",B),"interclue-selected");
  9445. Klib.removeClass($("interclue-menuitem-state-disable",B),"interclue-selected")
  9446. }else{if(A=="disabled"){Klib.removeClass($("interclue-menuitem-state-enable",B),"interclue-selected");
  9447. Klib.removeClass($("interclue-menuitem-state-disablefordomain",B),"interclue-selected");
  9448. Klib.removeClass($("interclue-menuitem-state-disableuntilrestart",B),"interclue-selected");
  9449. Klib.addClass($("interclue-menuitem-state-disable",B),"interclue-selected")
  9450. }}}}if(A=="enabled"){$("interclue-menuitem-state-enable",B).setAttribute("label","Interclue Enabled");
  9451. $("interclue-menuitem-state-disablefordomain",B).setAttribute("label","Disable Interclue on this site")
  9452. }else{if(A=="disabled-for-domain"){$("interclue-menuitem-state-enable",B).setAttribute("label","Enable Interclue on this site");
  9453. $("interclue-menuitem-state-disablefordomain",B).setAttribute("label","Interclue Disabled on this site")
  9454. }else{$("interclue-menuitem-state-enable",B).setAttribute("label","Enable Interclue on this site");
  9455. $("interclue-menuitem-state-disablefordomain",B).setAttribute("label","Disable Interclue on this site")
  9456. }}}};
  9457. Klib.Toolbar.getButtons=function(E){var I=Klib.Toolbar.getDoc();
  9458. if(I){var F=[];
  9459. for(var G=0;
  9460. G<Klib.Toolbar.buttonIds.length;
  9461. G++){var B=Klib.Toolbar.buttonIds[G];
  9462. if(E&&!Klib.inArray(B,E)){continue
  9463. }var D="interclue-"+B+"-statusbar-button";
  9464. var C=I.getElementById(D);
  9465. if(!Klib.Pref.get("CustomButtons.enabled")&&(B=="buttonload"||B=="buttoneditor")){continue
  9466. }if(C){C.buttonid=B;
  9467. if(!C.getAttribute("src")){var H=C.getElementsByTagName("img");
  9468. var A=(H&&H[0]&&H[0].src)?H[0].src:"";
  9469. C.setAttribute("src",A)
  9470. }F.push(C)
  9471. }}return F
  9472. }else{return false
  9473. }};
  9474. Klib.Toolbar.renderStatusbarButtonsTable=function(){var C=Klib.Toolbar.getButtons(["bugreport","referrerpage","currentpage"]);
  9475. if(C){var B=new Klib.Template();
  9476. B.template='<table id="interclue-preferencesdialog-statusbar-buttons" class="datatable" cellpadding="0" cellspacing="0" width="100%">            <tr class="thead">                <th> </th>                <th align="left">{_(clueframe.buttontable.title.action)}</th>                <th>{_(clueframe.buttontable.title.statusbar)}</th>                <th>{_(clueframe.buttontable.title.statusbar.menu)}</th>                <th>{_(clueframe.buttontable.title.statusbar.none)}</th>            </tr>            {foreach $btns as $btn}            <tr class="{cycle(odd, even)}">                <td class="td-icon"><img class="clueframe-button-image" src="{$btn.getAttribute("src")}" width="16" height="16" /></td>                <td class="td-text-main">{$btn.getAttribute("label")}</td>                <td class="td-checkbox"><input name="group-statusbar-{$btn.buttonid}" value="statusbar" preferenceid="ToolbarButton.{$btn.buttonid}.location" type="radio" datatype="text" /></td>                <td class="td-checkbox"><input name="group-statusbar-{$btn.buttonid}" value="statusbarmenu" preferenceid="ToolbarButton.{$btn.buttonid}.location" type="radio" datatype="text" /></td>                <td class="td-checkbox"><input name="group-statusbar-{$btn.buttonid}" value="" preferenceid="ToolbarButton.{$btn.buttonid}.location" type="radio" datatype="text" /></td>            </tr>            {/foreach}            </table>';
  9477. B.add("btns",C);
  9478. B.addFunction("_",_);
  9479. var A=B.render();
  9480. return A
  9481. }else{Klib.error("renderStatusbarButtonsTable: Unable to find toolbar doc");
  9482. return""
  9483. }};
  9484. Klib.GEvent.addEvent("statechange",Klib.Toolbar.refresh)
  9485. }if(Klib.install("Tutorial",0.1)){Klib.Tutorial.isTutorialUrl=function(A){return(A&&(A.indexOf(Klib.baseUrl+"/tutorial/")==0))
  9486. };
  9487. Klib.Tutorial.initDoc=function(A){if(Klib.Tutorial.isTutorialUrl(A.URL)){A.resetTutorialPageSecurity=Klib.Tutorial.resetTutorialPageSecurity;
  9488. A.resetClueframeSize=function(){Klib.Pref.reset("ClueFrame.width, ClueFrame.height")
  9489. };
  9490. A.closeClueViewer=function(){Klib.Tutorial.suppressEvents=true;
  9491. Klib.ClueFrame.hide(true);
  9492. Klib.Tutorial.suppressEvents=false
  9493. };
  9494. A.closeTab=Klib.ClueBridge.closeCurrentTab
  9495. }};
  9496. Klib.Tutorial.resetTutorialPageSecurity=function(A){if(A){Klib.Security.enableSiteFromDoc(A)
  9497. }};
  9498. Klib.Tutorial.openTutorial=function(){if(Klib.User.isLoggedIn(true)){Klib.Tutorial.showTutorial()
  9499. }};
  9500. Klib.Tutorial.showTutorial=function(B){Klib.Tutorial.resetTutorialPageSecurity();
  9501. Klib.Pref.reset("ClueFrame.width, ClueFrame.height");
  9502. var A=Klib.baseUrl+"/tutorial/index.html";
  9503. A+=(B)?("#"+B):"";
  9504. Klib.ClueBridge.openUrl(A,true,true)
  9505. };
  9506. Klib.Tutorial.fireEvent=function(C,E,A){if(C&&!Klib.Tutorial.suppressEvents){var D=Klib.getDoc(C);
  9507. if(D&&D.URL&&Klib.Tutorial.isTutorialUrl(D.URL)){var B=C["on"+E.toLowerCase()];
  9508. if(B){B(Klib.createEvent(C,E,A))
  9509. }}}else{}}
  9510. }Klib.UpdateScripts={};
  9511. Klib.UpdateScripts[2855]=function(){Klib.Pref.resetAll("Security.rules,User.uid,User.name,User.email,User.password,Url.unsafeWords,Url.safeDomains,Url.safeUrls,Privacy.privateUrls")
  9512. };
  9513. Klib.UpdateScripts[3153]=function(){if(Klib.Pref.get("ClueFrame.hotKey",[]).length==0){Klib.Pref.set("ClueFrame.hotKey",[Klib.KEY_CODE_CTRL])
  9514. }};
  9515. Klib.UpdateScripts[3202]=function(){if(Klib.App.subName!="alpha"){Klib.Pref.resetAll();
  9516. Klib.Pref.set("Update.lastBuild",0)
  9517. }};
  9518. Klib.UpdateScripts[3805]=function(){for(var A=0;
  9519. A<Klib.Toolbar.buttonIds.length;
  9520. A++){var B=Klib.Toolbar.buttonIds[A];
  9521. if(Klib.Pref.get("StatusButton."+B+".visible")){Klib.Pref.set("ToolbarButton."+B+".location","statusbar")
  9522. }else{if(Klib.Pref.get("StatusMenu."+B+".visible")){Klib.Pref.set("ToolbarButton."+B+".location","statusbarmenu")
  9523. }}Klib.Pref.kill("StatusButton."+B+".visible");
  9524. Klib.Pref.kill("StatusMenu."+B+".visible")
  9525. }};
  9526. Klib.UpdateScripts[4326]=function(){Klib.Pref.set("Summary.images","none")
  9527. };
  9528. Klib.UpdateScripts[4540]=function(){var A=Klib.Pref.get("ClueFrame.contentFontSize",0.75);
  9529. if(A<6){var B=Math.ceil(A*12);
  9530. if(B===NaN){B=9
  9531. }if(B<6){B=6
  9532. }if(B>16){B=16
  9533. }Klib.Pref.set("ClueFrame.contentFontSize",B)
  9534. }};
  9535. Klib.UpdateScripts[4692]=function(){if(!Klib.Pref.prefs["ClueFrame.hotKey"]){Klib.Pref.set("ClueFrame.hotKey",[Klib.KEY_CODE_CTRL])
  9536. }};
  9537. Klib.UpdateScripts[4769]=function(){Klib.Stats.clearAllStats()
  9538. };
  9539. Klib.UpdateScripts[4815]=function(){Klib.Pref.set("Summary.images",!!Klib.Pref.set("Summary.images"))
  9540. };
  9541. Klib.UpdateScripts[5181]=function(){Klib.Pref.set("Security.unsafeWords",Klib.Pref.get("Url.unsafeWords",""));
  9542. var H=Klib.Pref.get("Security.rules",[]);
  9543. for(var D=0;
  9544. D<H.length;
  9545. D++){var G=H[D];
  9546. if(G.logic=="disabled"){var C=G.regexUrl.replace(/\*/g,"");
  9547. var B=Klib.Url.getSiteFromUrl(C);
  9548. if(B){Klib.Security.disableSite(B)
  9549. }}}Klib.Pref.kill("Security.rules");
  9550. var A=Klib.Pref.get("Url.safeDomains","").split(/\s*,\s*/g);
  9551. for(var D=0;
  9552. D<A.length;
  9553. D++){var E=A[D];
  9554. Klib.Security.markSiteAsSafe("http://"+E+"/");
  9555. Klib.Security.markSiteAsSafe("https://"+E+"/")
  9556. }Klib.Pref.kill("Url.safeDomains");
  9557. var F=Klib.Pref.get("Url.safeUrls","").split(/\s*,\s*/g);
  9558. for(var D=0;
  9559. D<F.length;
  9560. D++){Klib.Security.markUrlAsSafe(F[D])
  9561. }Klib.Pref.kill("Url.safeUrls")
  9562. };
  9563. Klib.UpdateScripts[5275]=function(){var B=Klib.Pref.get("Security.sites");
  9564. var D={};
  9565. for(var C in B){var A=Klib.Url.getSiteFromUrl(C);
  9566. D[A]=B[C]
  9567. }Klib.Pref.set("Security.sites",D)
  9568. };
  9569. if(Klib.install("Update",0.1)){Klib.Update.checkedOnLogin=false;
  9570. Klib.Update.Obj=function(){var A=this;
  9571. A.startDownload=false;
  9572. A.showMessagesEle=null;
  9573. A.isBackgroundCheck=false;
  9574. A.check={};
  9575. A.sendQuery=function(){A.showMessage(Klib.getString("update.connecting.to.server"),"message",true);
  9576. Klib.Update.checking=true;
  9577. var D=Klib.getString("url.update");
  9578. if(Klib.Pref.get("Update.updateFromDev",false)){D="http://dev.izeal.com/xpi/versions.php"
  9579. }D=Klib.Url.add(D,"guid",Klib.User.getGuid());
  9580. D=Klib.Url.add(D,"build",Klib.App.build);
  9581. if(Klib.Pref.get("User.buildId")){D=Klib.Url.add(D,"bid",Klib.Pref.get("User.buildId"))
  9582. }D=Klib.Url.add(D,"lup",Klib.Pref.get("Update.lastUpdateTime",0));
  9583. D=Klib.Url.add(D,"ver",Klib.App.buildType);
  9584. if(Klib.Pref.get("User.allowAnonStats")){D=Klib.Url.add(D,"s",Klib.Stats.quickStats())
  9585. }D=Klib.Url.add(D,"ina",Klib.User.isLoggedIn()?0:1);
  9586. D=Klib.Url.noCache(D);
  9587. var C=Klib.Pref.copyUserPrefs(true);
  9588. var B=Klib.Json.encode(C);
  9589. var E=new Klib.Ajax.Obj(D);
  9590. E.onComplete=A.receiveQuery;
  9591. E.isJson=true;
  9592. E.addData("prefs",B);
  9593. E.send()
  9594. };
  9595. A.receiveQuery=function(F){Klib.Update.checking=false;
  9596. Klib.Pref.set("Update.lastCheck",Klib.timestamp());
  9597. Klib.Pref.set("Update.lastCheckFailed",F.error);
  9598. A.check.nightly=(A.check.nightly===undefined)?Klib.Pref.get("Update.check.nightly"):A.check.nightly;
  9599. A.check.experimental=(A.check.experimental===undefined)?Klib.Pref.get("Update.check.experimental"):A.check.experimental;
  9600. A.check.beta=(A.check.beta===undefined)?Klib.Pref.get("Update.check.beta"):A.check.beta;
  9601. A.check.stable=true;
  9602. if(!F.error){A.showMessage(Klib.getString("update.check.success"),"message",true);
  9603. if(F.json&&F.json.stable){var C=F.json;
  9604. Klib.Pref.set("Update.versions",C);
  9605. var G=false;
  9606. var D=["nightly","experimental","beta","stable"];
  9607. for(var E=0;
  9608. E<D.length;
  9609. E++){var B=D[E];
  9610. if(A.check[B]&&C[B]&&C[B].build>Klib.App.build){if(!A.isBackgroundCheck){A.showMessage(_("update.available."+B,{version:C[B].build}),"message",false);
  9611. Klib.GEvent.fire("updateavailable");
  9612. if(confirm(_("update.available."+B,{version:C[B].build})+"\n"+Klib.getString("update.download.now"))){Klib.ClueBridge.openUrl(C[B].downloadUrl)
  9613. }}else{A.showMessage(Klib.getString("update.have.latest.version"),"message",false,true)
  9614. }G=true;
  9615. break
  9616. }}if(!G){A.showMessage(Klib.getString("update.have.latest.version"),"message",false,true)
  9617. }}else{A.showMessage(Klib.getString("update.check.invalid.data"),"error",true);
  9618. Klib.error("Update check failed: invalid data",F.url,F.json)
  9619. }}else{A.showMessage(Klib.getString("update.check.failed"),"error",false,true);
  9620. Klib.error("Update check failed",F.url,F.statusText);
  9621. Klib.Update.checkedOnLogin=false
  9622. }};
  9623. A.showMessage=function(F,C,E,B){if(typeof A.showMessagesEle=="string"){var D=top.document.getElementById(A.showMessagesEle);
  9624. if(B){D.setAttribute("label","");
  9625. alert(F)
  9626. }else{D.setAttribute("label",F)
  9627. }}else{if(A.showMessagesEle){A.showMessagesEle.setAttribute("value",F);
  9628. A.showMessagesEle.disabled=E
  9629. }else{if(A.isBackgroundCheck){}else{if(B){alert(F)
  9630. }else{}}}}}
  9631. };
  9632. Klib.Update.checking=false;
  9633. Klib.Update.showMessagesEle=null;
  9634. Klib.Update.message=function(C,A,B){if(Klib.Update.showMessagesEle){Klib.Update.showMessagesEle.value=C;
  9635. Klib.Update.showMessagesEle.disabled=B
  9636. }else{Klib.Toolbar.status(C,A)
  9637. }};
  9638. Klib.Update.getUpdate=function(B){B=B||"stable";
  9639. var A=Klib.Pref.get("Update.versions");
  9640. if(A&&A[B]&&A[B].downloadUrl){var C=A[B].downloadUrl;
  9641. C=Klib.Url.noCache(C);
  9642. Klib.ClueBridge.openUrl(C)
  9643. }else{Klib.error("Invalid versions Klib.Update.getUpdate",B,A);
  9644. alert(Klib.getString("update.check.download.failed"))
  9645. }};
  9646. Klib.Update.checkForUpdates=function(E,G,D,C,A,F){var B=Klib.Pref.get("Update.checkForUpdates",1)*(60*60*24);
  9647. if(E||(B>0)){if(E||((!Klib.Update.checking)&&(Klib.timestamp()>(Klib.Pref.get("Update.lastCheck",0)+B)))){var H=new Klib.Update.Obj();
  9648. H.check.beta=C;
  9649. H.check.nightly=A;
  9650. H.check.experimental=F;
  9651. H.isBackgroundCheck=!G;
  9652. H.showMessagesEle=G;
  9653. H.startDownload=D;
  9654. H.sendQuery()
  9655. }}};
  9656. Klib.Update.startUpdateTimer=function(){if(Klib.ClueBridge.isBrowserWindow()){var A=Klib.Pref.get("Update.checkForUpdates",1);
  9657. if((!Klib.Update.checkedOnLogin)&&(A==-1)){Klib.Update.checkedOnLogin=true;
  9658. Klib.Update.checkForUpdates(true)
  9659. }else{if(A>0){Klib.setInterval("Klib.Update.tick",Klib.Update.checkForUpdates,(1*60*1000))
  9660. }}}};
  9661. Klib.Update.stopUpdateTimer=function(){Klib.clearTimer("Klib.Update.tick")
  9662. };
  9663. Klib.Update.resetWindow=function(){Klib.Update.checkedOnLogin=false
  9664. };
  9665. Klib.Update.runUpdateScripts=function(){var A=top.interclue.getPref("interclue.build",0);
  9666. top.interclue.setPref("interclue.build",Klib.App.build);
  9667. top.interclue.savePrefFile();
  9668. if(!A){A=Klib.Pref.getInt("Update.lastBuild",0);
  9669. Klib.logger("retrieved last build from legacy code",A)
  9670. }if(A<1){Klib.Pref.resetAll()
  9671. }if((A>0)&&(Klib.App.build>A)){Klib.logger("Updating: from "+A+" to "+Klib.App.build);
  9672. for(var C in Klib.UpdateScripts){if(parseInt(C)>=A){Klib.logger("Updating: running update script",C);
  9673. try{Klib.UpdateScripts[C]()
  9674. }catch(B){Klib.error(B)
  9675. }}}}if(A==0){Klib.Pref.set("Update.lastUpdateTime",Klib.timestamp());
  9676. Klib.GEvent.fire("install")
  9677. }else{if(Klib.App.build>A){Klib.Pref.set("Update.lastUpdateTime",Klib.timestamp());
  9678. Klib.GEvent.fire("update",[A,Klib.App.build])
  9679. }}if(Klib.App.build>A){Klib.Pref.set("Update.lastBuild",Klib.App.build)
  9680. }};
  9681. Klib.Update.openUpdateUrl=function(){if(Klib.getString("url.onupdate")){var B=Klib.getString("url.onupdate");
  9682. var A=Klib.Pref.get("Update.checkForUpdates");
  9683. if(A!=1&&A!=-1){B=B.replace(/#.*$/,"");
  9684. B+="?from=firefox&u="+A+"&guid="+Klib.User.getGuid()
  9685. }Klib.ClueBridge.openUrl(B,true,true,true)
  9686. }};
  9687. Klib.Update.openInstallUrl=function(){if(Klib.getString("url.oninstall")){Klib.ClueBridge.openUrl(Klib.getString("url.oninstall"),true,true,true)
  9688. }};
  9689. Klib.GEvent.addEvent("login",Klib.Update.runUpdateScripts);
  9690. Klib.GEvent.addEvent("logout",Klib.Update.resetWindow);
  9691. Klib.GEvent.addEvent("logout",Klib.Update.stopUpdateTimer);
  9692. Klib.GEvent.addEvent("update",Klib.Update.openUpdateUrl);
  9693. Klib.GEvent.addEvent("install",Klib.Update.openInstallUrl)
  9694. }Klib.getInterclueUrl=function(C,B){var A=Klib.urls[C];
  9695. if(B){A+=(A.indexOf("#")>-1)?(":from:"+Klib.platform):("#from:"+Klib.platform)
  9696. }return A
  9697. };
  9698. Klib.urls={};
  9699. Klib.urls.bugreporter="https://interclue.com/pluginapi/feedback.php";
  9700. Klib.urls.website="http://interclue.com/";
  9701. Klib.urls.donate="http://interclue.com/donate.html";
  9702. Klib.urls.bookmark="https://interclue.com/ClueServer/userLink.php?action:save";
  9703. Klib.init=function(){if(Klib.initalized===undefined){Klib.initalized=false;
  9704. Klib.debugging=top.interclue.getPref("interclue.debug",false);
  9705. Klib.GEvent.addEvent("logout",Klib.User.handleLogout);
  9706. Klib.GEvent.addEvent("login",Klib.User.handleLogin);
  9707. Klib.GEvent.addEvent("login",Klib.Clue.handleLogin);
  9708. Klib.GEvent.addEvent("logout",Klib.Clue.handleLogout);
  9709. Klib.GEvent.addEvent("login",Klib.Toolbar.refresh);
  9710. Klib.GEvent.addEvent("logout",Klib.Toolbar.refresh);
  9711. Klib.GEvent.addEvent("updateavailable",Klib.Toolbar.refresh);
  9712. Klib.GEvent.addEvent("logout",Klib.LinkScent.cleanupCurrentDoc);
  9713. Klib.GEvent.addEvent("login",Klib.ClueBridge.init);
  9714. Klib.GEvent.addEvent("login",Klib.ClueBridge.handleLogin);
  9715. Klib.GEvent.addEvent("logout",Klib.ClueBridge.handleLogout);
  9716. Klib.GEvent.addEvent("login",Klib.Update.startUpdateTimer);
  9717. Klib.GEvent.addEvent("logout",Klib.Update.stopUpdateTimer);
  9718. Klib.GEvent.addEvent("login",Klib.Stats.init);
  9719. Klib.GEvent.addEvent("logout",Klib.Stats.cleanUp);
  9720. Klib.GEvent.addEvent("windowclose",Klib.Stats.save);
  9721. Klib.GEvent.addEvent("prefchanged",Klib.Pref.onPrefChanged);
  9722. Klib.GEvent.addEvent("prefchanged",Klib.Locale.onPrefChanged);
  9723. Klib.Locale.loadLanguage("en");
  9724. Klib.Global.load();
  9725. Klib.User.winLoggedIn=false;
  9726. Klib.initalized=true;
  9727. Klib.GEvent.start();
  9728. Klib.Pref.load();
  9729. Klib.addEvent(window,"beforeunload",Klib.Pref.save);
  9730. if(Klib.App.requireLogin&&(Klib.Pref.get("User.uid")=="guest")){Klib.Pref.set("User.uid","")
  9731. }if(!Klib.User.loginAtStartup()){top.addEventListener("resize",Klib.User.loginAtStartup,true)
  9732. }}};